aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoradrido <robots_only_adrido@gmx.com>2019-04-07 18:45:25 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-04-07 18:45:25 +0200
commit25f231a0e023b0ace5604f167b5189529bd2598f (patch)
treede3e1eaed830bc00895de9f67c5387277dbe6558 /src
parent1db4ae96b1a1fa7c5b383a505a0b0b74b836551a (diff)
downloadminetest-25f231a0e023b0ace5604f167b5189529bd2598f.tar.gz
minetest-25f231a0e023b0ace5604f167b5189529bd2598f.tar.bz2
minetest-25f231a0e023b0ace5604f167b5189529bd2598f.zip
Find PostgreSQL correctly (#8435)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 764706776..45008e337 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -159,27 +159,14 @@ option(ENABLE_POSTGRESQL "Enable PostgreSQL backend" TRUE)
set(USE_POSTGRESQL FALSE)
if(ENABLE_POSTGRESQL)
- find_program(POSTGRESQL_CONFIG_EXECUTABLE pg_config DOC "pg_config")
- find_library(POSTGRESQL_LIBRARY pq)
- if(POSTGRESQL_CONFIG_EXECUTABLE)
- execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE} --includedir-server
- OUTPUT_VARIABLE POSTGRESQL_SERVER_INCLUDE_DIRS
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE}
- OUTPUT_VARIABLE POSTGRESQL_CLIENT_INCLUDE_DIRS
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- # This variable is case sensitive for the cmake PostgreSQL module
- set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${POSTGRESQL_SERVER_INCLUDE_DIRS} ${POSTGRESQL_CLIENT_INCLUDE_DIRS})
- endif()
-
find_package("PostgreSQL")
- if(POSTGRESQL_FOUND)
+ if(PostgreSQL_FOUND)
set(USE_POSTGRESQL TRUE)
message(STATUS "PostgreSQL backend enabled")
# This variable is case sensitive, don't try to change it to POSTGRESQL_INCLUDE_DIR
- message(STATUS "PostgreSQL includes: ${PostgreSQL_INCLUDE_DIR}")
- include_directories(${PostgreSQL_INCLUDE_DIR})
+ message(STATUS "PostgreSQL includes: ${PostgreSQL_INCLUDE_DIRS}")
+ include_directories(${PostgreSQL_INCLUDE_DIRS})
else()
message(STATUS "PostgreSQL not found!")
endif()
@@ -593,7 +580,7 @@ if(BUILD_CLIENT)
target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES})
endif()
if (USE_POSTGRESQL)
- target_link_libraries(${PROJECT_NAME} ${POSTGRESQL_LIBRARY})
+ target_link_libraries(${PROJECT_NAME} ${PostgreSQL_LIBRARIES})
endif()
if (USE_LEVELDB)
target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY})
@@ -628,7 +615,7 @@ if(BUILD_SERVER)
target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES})
endif()
if (USE_POSTGRESQL)
- target_link_libraries(${PROJECT_NAME}server ${POSTGRESQL_LIBRARY})
+ target_link_libraries(${PROJECT_NAME}server ${PostgreSQL_LIBRARIES})
endif()
if (USE_LEVELDB)
target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY})