summaryrefslogtreecommitdiff
path: root/Modules/FindPostgreSQL.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindPostgreSQL.cmake')
-rw-r--r--Modules/FindPostgreSQL.cmake20
1 files changed, 8 insertions, 12 deletions
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 94e5676fe..e3c898b98 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -35,7 +35,7 @@
#
# To use this variable just do something like this:
# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
-# before calling FIND_PACKAGE(PostgreSQL) in your CMakeLists.txt file.
+# before calling find_package(PostgreSQL) in your CMakeLists.txt file.
# This will mean that the versions you set here will be found first in the order
# specified before the default ones are searched.
#
@@ -61,7 +61,7 @@
# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is
# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path()
# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file
-# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
+# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have
# installed PostgreSQL, e.g. <Your Path>.
#
@@ -74,11 +74,6 @@ set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache e
set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4")
-set(PostgreSQL_ROOT_DIRECTORIES $ENV{PostgreSQL_ROOT})
-if(PostgreSQL_ROOT_DIRECTORIES)
- file(TO_CMAKE_PATH ${PostgreSQL_ROOT_DIRECTORIES} PostgreSQL_ROOT_DIRECTORIES)
-endif(PostgreSQL_ROOT_DIRECTORIES)
-
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
"9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
@@ -86,10 +81,10 @@ set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
if ( WIN32 )
foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} )
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" )
- endforeach(suffix)
-endif( WIN32 )
+ endforeach()
+endif()
set( PostgreSQL_ROOT_DIRECTORIES
- ${PostgreSQL_ROOT_DIRECTORIES}
+ ENV PostgreSQL_ROOT
${PostgreSQL_ROOT}
${PostgreSQL_ADDITIONAL_SEARCH_PATHS}
)
@@ -116,6 +111,7 @@ find_path(PostgreSQL_TYPE_INCLUDE_DIR
# Look in other places.
${PostgreSQL_ROOT_DIRECTORIES}
PATH_SUFFIXES
+ postgresql
pgsql/server
postgresql/server
include/server
@@ -151,7 +147,7 @@ if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
endif()
# Did we find anything?
-include(FindPackageHandleStandardArgs)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PostgreSQL
REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
VERSION_VAR PostgreSQL_VERSION_STRING)
@@ -167,6 +163,6 @@ if(PostgreSQL_FOUND)
#message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}")
#message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}")
#message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}")
-endif(PostgreSQL_FOUND)
+endif()
mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY )