diff options
author | Brad King <brad.king@kitware.com> | 2019-11-05 16:31:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-05 16:31:24 (GMT) |
commit | 3c0a317a1d111fb1012de45c39b81048f5a700d9 (patch) | |
tree | 2632c1db66abea24ebbb51adae8a4f28fde97638 /Tests | |
parent | 0ec60a400234624b258307a7944184828c8b6abc (diff) | |
parent | e992d62b7e15be28c8d560071bcf847f28d9fbb1 (diff) | |
download | CMake-3c0a317a1d111fb1012de45c39b81048f5a700d9.zip CMake-3c0a317a1d111fb1012de45c39b81048f5a700d9.tar.gz CMake-3c0a317a1d111fb1012de45c39b81048f5a700d9.tar.bz2 |
Merge branch 'findpostgres-10-and-older' into release-3.16
Merge-request: !3993
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); |