summaryrefslogtreecommitdiffstats
path: root/CMake/Modules/FindPostgreSQL.cmake
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2010-01-29 00:14:29 +0100
committerBertram <bertram@cegetel.net>2010-01-29 00:14:29 +0100
commit9b6377b7d34805535b810a54c5b09c3fd23b3ca8 (patch)
treecaab37efa17d72d1205e929a9886070edeb356cb /CMake/Modules/FindPostgreSQL.cmake
parentf7f0f36c3fec7786e15ee79c7aa184c50caa3cd7 (diff)
downloadmanaserv-9b6377b7d34805535b810a54c5b09c3fd23b3ca8.tar.gz
manaserv-9b6377b7d34805535b810a54c5b09c3fd23b3ca8.tar.xz
manaserv-9b6377b7d34805535b810a54c5b09c3fd23b3ca8.zip
Upgraded CMakeLists.txt files to deal with compile option. I have still one problem with Lua...
There must be something wrong in the FindLua.cmake module because the FIND_PACKAGE(Lua) doesn't work and is currently commented out.
Diffstat (limited to 'CMake/Modules/FindPostgreSQL.cmake')
-rw-r--r--CMake/Modules/FindPostgreSQL.cmake53
1 files changed, 53 insertions, 0 deletions
diff --git a/CMake/Modules/FindPostgreSQL.cmake b/CMake/Modules/FindPostgreSQL.cmake
new file mode 100644
index 0000000..1052440
--- /dev/null
+++ b/CMake/Modules/FindPostgreSQL.cmake
@@ -0,0 +1,53 @@
+# - Find PostgreSQL
+# Find the PostgreSQL includes and client library
+# This module defines
+# POSTGRESQL_INCLUDE_DIR, where to find POSTGRESQL.h
+# POSTGRESQL_LIBRARIES, the libraries needed to use POSTGRESQL.
+# POSTGRESQL_FOUND, If false, do not try to use PostgreSQL.
+
+# Eventually add the postgresql include paths here
+
+if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+ set(POSTGRESQL_FOUND TRUE)
+
+else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+
+# When using libpqfe, use this:
+# find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h
+
+ FIND_PATH(POSTGRESQL_INCLUDE_DIR postgres.h
+ /usr/include/server
+ /usr/include/pgsql/server
+ /usr/local/include/pgsql/server
+ /usr/include/postgresql/server
+ /usr/include/postgresql/*/server
+ /usr/local/include/postgresql/server
+ /usr/local/include/postgresql/*/server
+ $ENV{ProgramFiles}/PostgreSQL/*/include/server
+ $ENV{SystemDrive}/PostgreSQL/*/include/server
+ )
+
+ find_library(POSTGRESQL_LIBRARIES NAMES pq libpq
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /usr/lib/postgresql
+ /usr/lib64
+ /usr/local/lib64
+ /usr/lib64/postgresql
+ $ENV{ProgramFiles}/PostgreSQL/*/lib/ms
+ $ENV{SystemDrive}/PostgreSQL/*/lib/ms
+ )
+
+ if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+ set(POSTGRESQL_FOUND TRUE)
+ message(STATUS "Found PostgreSQL: ${POSTGRESQL_INCLUDE_DIR}, ${POSTGRESQL_LIBRARIES}")
+ INCLUDE_DIRECTORIES(${POSTGRESQL_INCLUDE_DIR})
+ else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+ set(POSTGRESQL_FOUND FALSE)
+ message(STATUS "PostgreSQL not found.")
+ endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+
+ mark_as_advanced(POSTGRESQL_INCLUDE_DIR POSTGRESQL_LIBRARIES)
+
+endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)