PERSISTENCE: check the libpq path that was detected by cmake

master
Martin Gerhardy 2018-11-26 07:32:09 +01:00
parent 1155c84daa
commit fc04257643
3 changed files with 8 additions and 1 deletions

View File

@ -21,3 +21,5 @@
#cmakedefine OPENCL_LIBRARY "@OPENCL_LIBRARY@"
#cmakedefine BASE_URL "@BASE_URL@"
#cmakedefine DB_PW "@DB_PW@"
#cmakedefine POSTGRESQL_LIBS "@POSTGRESQL_LIBS@"

View File

@ -50,6 +50,7 @@ else()
message(WARNING "No postgres was found on your system. Make sure to have libpq and pg_type.h installed on your system")
endif()
set(HAVE_POSTGRES ${PostgreSQL_FOUND} CACHE BOOL "Found postgres" FORCE)
set(POSTGRESQL_LIBS "${PostgreSQL_LIBRARIES}" CACHE STRING "PostgreSQL libraries" FORCE)
message(STATUS "Postgresql include dirs: ${PostgreSQL_INCLUDE_DIRS}")
message(STATUS "Postgresql libs: ${PostgreSQL_LIBRARIES}")

View File

@ -67,7 +67,11 @@ bool postgresInit() {
}
if (obj == nullptr) {
const char *searchPaths[] = {"libpq.so", nullptr};
const char *searchPaths[] = {
#ifdef POSTGRESQL_LIBS
POSTGRESQL_LIBS
#endif
"libpq.so", nullptr};
for (const char **searchPath = searchPaths; *searchPath; ++searchPath) {
obj = SDL_LoadObject(*searchPath);
if (obj != nullptr) {