pgrouting
pgrouting copied to clipboard
Update CMakeLists.txt to allow building with other Postgres variants
The current logic to get the version from the version string depends on the position (11) which may not work with other postgres variants because of the different strings they may carry like EnterpriseDB for an example.
So instead of of using string substring to parse the version, use string regex match. Also, move up the code to replace the strings alpha/beta/rc a bit to support the patch
Tested on Linux
Fixes # .
Changes proposed in this pull request:
@pgRouting/admins
@cvvergara can you please help review with this?
@sandeep-edb I need to test with postgres 15 dev & rc Will leave this PR open and do the testing after 3.4 gets released
Testing with different POSTGRESQL_VERSION_STRING strings:
Test1
-- POSTGRESQL_VERSION_STRING=PostgreSQL 15rc1 on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
-- POSTGRESQL_VERSION_STRING=PostgreSQL 15.0
-- POSTGRESQL_VERSION=15.0
Test 2:
-- POSTGRESQL_VERSION_STRING=PostgreSQL 14.5 (Ubuntu 14.5-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, 64-bit
-- POSTGRESQL_VERSION_STRING=PostgreSQL 14.5 (Ubuntu 14.5-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, 64-bit
-- POSTGRESQL_VERSION=14.5
Test 3:
- POSTGRESQL_VERSION_STRING=PostgreSQL 13.8beta1 (Ubuntu 13.8-1.pgdg20.04+1
-- POSTGRESQL_VERSION_STRING=PostgreSQL 13.8.0
-- POSTGRESQL_VERSION=13.8
Looks like it works :-)