From 2b261db9d399c5ef291bd5f11d1979460c915c88 Mon Sep 17 00:00:00 2001 From: reshke Date: Fri, 3 Dec 2021 17:47:09 +0000 Subject: [PATCH] Use Postgresql Version number from pg_config.h --- cmake/FindPostgreSQL.cmake | 8 +++++++- sources/build.h.cmake | 1 - sources/postgres.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/FindPostgreSQL.cmake b/cmake/FindPostgreSQL.cmake index be3b9bce..cf37b3a5 100644 --- a/cmake/FindPostgreSQL.cmake +++ b/cmake/FindPostgreSQL.cmake @@ -4,6 +4,7 @@ # POSTGRESQL_INCLUDE_DIR - PostgreSQL include directory # POSTGRESQL_LIBRARY - PostgreSQL library # PQ_LIBRARY - PostgreSQL PQ library +# PQ_LIBRARY - PostgreSQL version if("${POSTGRESQL_INCLUDE_DIR}" STREQUAL "" OR "${POSTGRESQL_INCLUDE_DIR}" STREQUAL "POSTGRESQL_INCLUDE_DIR-NOTFOUND") find_path( @@ -16,12 +17,17 @@ if("${POSTGRESQL_INCLUDE_DIR}" STREQUAL "" OR "${POSTGRESQL_INCLUDE_DIR}" STREQU OUTPUT_VARIABLE PG_INCLUDE_SERVER OUTPUT_STRIP_TRAILING_WHITESPACE ) + + execute_process ( + COMMAND pg_config --version + OUTPUT_VARIABLE PG_VERSION_NUM + OUTPUT_STRIP_TRAILING_WHITESPACE + ) set(POSTGRESQL_INCLUDE_DIR ${PG_INCLUDE_SERVER}) endif() -set(PG_VERSION_NUM "140000") execute_process ( COMMAND pg_config --libdir diff --git a/sources/build.h.cmake b/sources/build.h.cmake index 875ab3b4..9b68c674 100644 --- a/sources/build.h.cmake +++ b/sources/build.h.cmake @@ -14,6 +14,5 @@ #cmakedefine PAM_FOUND @PAM_FOUND@ #cmakedefine LDAP_FOUND @LDAP_FOUND@ #cmakedefine PROM_FOUND @PROM_FOUND@ -#cmakedefine PG_VERSION_NUM @PG_VERSION_NUM@ #endif /* ODYSSEY_BUILD_H */ diff --git a/sources/postgres.h b/sources/postgres.h index 2fb96058..59317538 100644 --- a/sources/postgres.h +++ b/sources/postgres.h @@ -27,5 +27,6 @@ #include #include #include +#include #endif /* ODYSSEY_POSTGRES_H */