From b7ca6f90371e5f748148531f228c03dd1a13f5e4 Mon Sep 17 00:00:00 2001 From: Tamar Kranenburg Date: Sat, 30 May 2015 15:17:47 +0200 Subject: FindPostgreSQL: Remove unused lines --- Modules/FindPostgreSQL.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 97666c8..9e9f864 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -173,14 +173,9 @@ set( PostgreSQL_FOUND ${POSTGRESQL_FOUND}) # Now try to get the include and library path. if(PostgreSQL_FOUND) - set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} ) set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} ) set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND}) - - #message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}") - #message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}") - #message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}") endif() mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY ) -- cgit v0.12 From 6a2851a1449eea9c42d6482c242fb0ca0ba01b12 Mon Sep 17 00:00:00 2001 From: Tamar Kranenburg Date: Sat, 30 May 2015 15:17:47 +0200 Subject: FindPostgreSQL: Remove extra whitespace after command open parens --- Modules/FindPostgreSQL.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 9e9f864..a3ecebd 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -133,10 +133,10 @@ set (PostgreSQL_LIBRARY_TO_FIND pq) set (PostgreSQL_LIB_PREFIX "") if ( WIN32 ) set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib") - set ( PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND}) + set (PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND}) endif() -find_library( PostgreSQL_LIBRARY +find_library(PostgreSQL_LIBRARY NAMES ${PostgreSQL_LIBRARY_TO_FIND} PATHS ${PostgreSQL_ROOT_DIRECTORIES} @@ -169,7 +169,7 @@ 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) -set( PostgreSQL_FOUND ${POSTGRESQL_FOUND}) +set(PostgreSQL_FOUND ${POSTGRESQL_FOUND}) # Now try to get the include and library path. if(PostgreSQL_FOUND) -- cgit v0.12 From cc3aee048c7bfee40cca43257e66140f158f032a Mon Sep 17 00:00:00 2001 From: Tamar Kranenburg Date: Sat, 30 May 2015 15:17:47 +0200 Subject: FindPostgreSQL: Search for versions 9.2, 9.3, and 9.4 --- Modules/FindPostgreSQL.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index a3ecebd..b0af817 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -39,7 +39,7 @@ # In Windows the default installation of PostgreSQL uses that as part of the path. # E.g C:\Program Files\PostgreSQL\8.4. # Currently, the following version numbers are known to this module: -# "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" +# "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" # # To use this variable just do something like this: # set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") @@ -83,7 +83,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") + "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") # Define additional search paths for root directories. if ( WIN32 ) -- cgit v0.12 From a68e9b7cae123d8388b5aa55d991df86aaf18d43 Mon Sep 17 00:00:00 2001 From: Tamar Kranenburg Date: Sat, 30 May 2015 15:17:47 +0200 Subject: FindPostgreSQL: Document PostgreSQL_LIBRARY_DIRS result variable --- Modules/FindPostgreSQL.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index b0af817..fba0ca0 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -13,6 +13,7 @@ # # PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking # PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers +# PostgreSQL_LIBRARY_DIRS - the link directories for PostgreSQL libraries # PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8) #============================================================================= -- cgit v0.12 From 8bd9505976731a24d07ee7d52e130e3d6521d1ed Mon Sep 17 00:00:00 2001 From: Tamar Kranenburg Date: Sat, 30 May 2015 15:17:47 +0200 Subject: FindPostgreSQL: Add help text for PostgreSQL_LIBRARY cache entry The PostgreSQL_LIBRARY_DIR_MESSAGE variable was set with the needed text but never referenced. --- Modules/FindPostgreSQL.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index fba0ca0..e3541bc 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -143,6 +143,8 @@ find_library(PostgreSQL_LIBRARY ${PostgreSQL_ROOT_DIRECTORIES} PATH_SUFFIXES lib + # Help the user find it if we cannot. + DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}" ) get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) -- cgit v0.12 From d4fd30d8d8f5b9c4b5a110b4676cad2a19d7c314 Mon Sep 17 00:00:00 2001 From: Tamar Kranenburg Date: Sat, 30 May 2015 15:17:47 +0200 Subject: FindPostgreSQL: Search some more common packaging locations Use PATH_SUFFIXES to search more common packaging locations. On Windows, we can use suffixes to search in the standard Program Files locations without hard-coding the C:/ path. On Ubuntu/Debian, starting with PostgreSQL 9.3 the header file pg_type.h is moved to a separate package (from libpq-dev to postgresql-server-dev) and consequently the file pg_type.h is moved to a new location: /usr/include/postgresql//server/catalog/pg_type.h While at it, use separate PATH_SUFFIXES variables for library, type and include (this is merely an optimization). --- Modules/FindPostgreSQL.cmake | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index e3541bc..3ce2c73 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -4,9 +4,6 @@ # # Find the PostgreSQL installation. # -# In Windows, we make the assumption that, if the PostgreSQL files are -# installed, the default directory will be C:\Program Files\PostgreSQL. -# # This module defines # # :: @@ -87,16 +84,24 @@ set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") # Define additional search paths for root directories. -if ( WIN32 ) - foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} ) - set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" ) - endforeach() -endif() set( PostgreSQL_ROOT_DIRECTORIES ENV PostgreSQL_ROOT ${PostgreSQL_ROOT} - ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} ) +foreach(suffix ${PostgreSQL_KNOWN_VERSIONS}) + if(WIN32) + list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES + "PostgreSQL/${suffix}/lib") + list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES + "PostgreSQL/${suffix}/include") + list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES + "PostgreSQL/${suffix}/include/server") + endif() + if(UNIX) + list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES + "postgresql/${suffix}/server") + endif() +endforeach() # # Look for an installation. @@ -110,6 +115,7 @@ find_path(PostgreSQL_INCLUDE_DIR pgsql postgresql include + ${PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES} # Help the user find it if we cannot. DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" ) @@ -124,6 +130,7 @@ find_path(PostgreSQL_TYPE_INCLUDE_DIR pgsql/server postgresql/server include/server + ${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES} # Help the user find it if we cannot. DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" ) @@ -143,6 +150,7 @@ find_library(PostgreSQL_LIBRARY ${PostgreSQL_ROOT_DIRECTORIES} PATH_SUFFIXES lib + ${PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES} # Help the user find it if we cannot. DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}" ) -- cgit v0.12