diff --git a/CMakeLists.txt b/CMakeLists.txt index c523b79d51f..bdc4256f22d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,15 +169,16 @@ if(NOT POSTGRESQL_FOUND OR NOT POSTGRESQL_VERSION_STRING) message(FATAL_ERROR "PostgreSQL not found - Please check your PostgreSQL installation.") endif() +# for XbetaY XalphaY XrcY -> X.Y +string(REGEX REPLACE "([0-9]+)[beta|alpha|rc|devel].*" "\\1.0" POSTGRESQL_VERSION_STRING ${POSTGRESQL_VERSION_STRING}) message(STATUS "POSTGRESQL_VERSION_STRING=${POSTGRESQL_VERSION_STRING}") -string(SUBSTRING "${POSTGRESQL_VERSION_STRING}" 11 -1 POSTGRESQL_VERSION) -# for XbetaY XalphaY XrcY -> X.Y -string(REGEX REPLACE "^([0-9]+)[beta|alpha|rc|devel].*" "\\1.0" POSTGRESQL_VERSION ${POSTGRESQL_VERSION}) +STRING(REGEX MATCH "([0-9]+)\.([0-9]+)" POSTGRESQL_VERSION "${POSTGRESQL_VERSION_STRING}") +message(STATUS "POSTGRESQL_VERSION=${POSTGRESQL_VERSION}") #for X.Y.Z -> XY Y<10 string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*" "\\1\\2" PGSQL_VERSION ${POSTGRESQL_VERSION}) - +#message(STATUS "PGSQL_VERSION=${PGSQL_VERSION}") if("${POSTGRESQL_VERSION}" VERSION_LESS "${POSTGRESQL_MINIMUM_VERSION}") message(FATAL_ERROR " PostgreSQL ${POSTGRESQL_MINIMUM_VERSION} or greater is required.")