pgRouting / pgrouting

Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
https://pgrouting.org
GNU General Public License v2.0
1.16k stars 366 forks source link

Update CMakeLists.txt to allow building with other Postgres variants #2362

Closed sandeep-edb closed 2 years ago

sandeep-edb commented 2 years ago

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

sandeep-edb commented 2 years ago

@cvvergara can you please help review with this?

cvvergara commented 2 years ago

@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

cvvergara commented 2 years ago

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 :-)