summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-11-05 16:23:39 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-11-05 16:23:59 (GMT)
commit3521e3d524447f0f3ac20f8e2df2435dd6de7aa2 (patch)
tree506208f4c11b0a208ebb3c2d3a7db04d8b82c11d /Modules
parent153226a1471d38ecf54b807a0d6cfa30c436166a (diff)
parente992d62b7e15be28c8d560071bcf847f28d9fbb1 (diff)
downloadCMake-3521e3d524447f0f3ac20f8e2df2435dd6de7aa2.zip
CMake-3521e3d524447f0f3ac20f8e2df2435dd6de7aa2.tar.gz
CMake-3521e3d524447f0f3ac20f8e2df2435dd6de7aa2.tar.bz2
Merge topic 'findpostgres-10-and-older'
e992d62b7e FindPostgreSQL: support version encoding used in pre-10 releases Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3993
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindPostgreSQL.cmake21
1 files changed, 16 insertions, 5 deletions
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index cfa4ebc..4fcc79d 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -208,11 +208,22 @@ if (PostgreSQL_INCLUDE_DIR)
endif()
endforeach()
if (_PostgreSQL_VERSION_NUM)
- math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000")
- math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000")
- set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}")
- unset(_PostgreSQL_major_version)
- unset(_PostgreSQL_minor_version)
+ # 9.x and older encoding
+ if (_PostgreSQL_VERSION_NUM LESS 100000)
+ math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000")
+ math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000 / 100")
+ math(EXPR _PostgreSQL_patch_version "${_PostgreSQL_VERSION_NUM} % 100")
+ set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}.${_PostgreSQL_patch_version}")
+ unset(_PostgreSQL_major_version)
+ unset(_PostgreSQL_minor_version)
+ unset(_PostgreSQL_patch_version)
+ else ()
+ math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000")
+ math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000")
+ set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}")
+ unset(_PostgreSQL_major_version)
+ unset(_PostgreSQL_minor_version)
+ endif ()
else ()
foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
if(EXISTS "${_PG_CONFIG_HEADER}")