Look for PostgreSQL library properly and fix CI

* fixed in cmake 3.20 but it's relatively easy to add a workaround
* This was only fixed by Kitware/CMake@8b066f1 (CMake 3.20),
* backported a24899bf2d
* https://codeberg.org/minenux/minenux/issues/32
This commit is contained in:
mckaygerhard 2023-01-05 08:55:05 -04:00
parent 2cf3b684f2
commit 2e7be0b9f1

View File

@ -187,7 +187,16 @@ if(ENABLE_POSTGRESQL)
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${POSTGRESQL_SERVER_INCLUDE_DIRS} ${POSTGRESQL_CLIENT_INCLUDE_DIRS})
endif()
find_package("PostgreSQL")
if(CMAKE_VERSION VERSION_LESS "3.20")
find_package(PostgreSQL QUIET)
# Before CMake 3.20 FindPostgreSQL.cmake always looked for server includes
# but we don't need them, so continue anyway if only those are missing.
if(PostgreSQL_INCLUDE_DIR AND PostgreSQL_LIBRARY)
set(PostgreSQL_FOUND TRUE)
endif()
else()
find_package(PostgreSQL)
endif()
if(POSTGRESQL_FOUND)
set(USE_POSTGRESQL TRUE)