diff options
author | Brad King <brad.king@kitware.com> | 2019-11-07 14:28:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-07 14:29:20 (GMT) |
commit | 4011b1be41e97de3f1c1cee741f0627838913974 (patch) | |
tree | c71b0d5ceb916a0469d84902deaf7f0823edbb1f /Tests | |
parent | 2a5e5b25ba4d6eb68dbee29381774562c98e228f (diff) | |
parent | aeae4182cb90cbf65b1c27cc877f62d2c7690aaf (diff) | |
download | CMake-4011b1be41e97de3f1c1cee741f0627838913974.zip CMake-4011b1be41e97de3f1c1cee741f0627838913974.tar.gz CMake-4011b1be41e97de3f1c1cee741f0627838913974.tar.bz2 |
Merge branch 'backport-findpostgres-10-and-older' into release-3.15
Merge-request: !4007
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindPostgreSQL/Test/main.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Tests/FindPostgreSQL/Test/main.c b/Tests/FindPostgreSQL/Test/main.c index 2cfeed0..a63377a 100644 --- a/Tests/FindPostgreSQL/Test/main.c +++ b/Tests/FindPostgreSQL/Test/main.c @@ -5,10 +5,19 @@ int main() { int version = PQlibVersion(); - int major = version / 10000; - int minor = version % 10000; char version_string[100]; - snprintf(version_string, sizeof(version_string), "%d.%d", major, minor); + // 9.x and older encoding. + if (version < 100000) { + int major = version / 10000; + int minor = version % 10000 / 100; + int patch = version % 100; + snprintf(version_string, sizeof(version_string), "%d.%d.%d", major, minor, + patch); + } else { + int major = version / 10000; + int minor = version % 10000; + snprintf(version_string, sizeof(version_string), "%d.%d", major, minor); + } printf("Found PostgreSQL version %s, expected version %s\n", version_string, CMAKE_EXPECTED_POSTGRESQL_VERSION); return strcmp(version_string, CMAKE_EXPECTED_POSTGRESQL_VERSION); |