diff options
author | Tamar Kranenburg <info@takar.nl> | 2015-05-30 13:17:47 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-06-01 15:01:00 (GMT) |
commit | d4fd30d8d8f5b9c4b5a110b4676cad2a19d7c314 (patch) | |
tree | c8dd487fd5f470bcc7599c191b416ad18cc78195 /Modules/FindPostgreSQL.cmake | |
parent | 8bd9505976731a24d07ee7d52e130e3d6521d1ed (diff) | |
download | CMake-d4fd30d8d8f5b9c4b5a110b4676cad2a19d7c314.zip CMake-d4fd30d8d8f5b9c4b5a110b4676cad2a19d7c314.tar.gz CMake-d4fd30d8d8f5b9c4b5a110b4676cad2a19d7c314.tar.bz2 |
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/<version>/server/catalog/pg_type.h
While at it, use separate PATH_SUFFIXES variables for library, type and
include (this is merely an optimization).
Diffstat (limited to 'Modules/FindPostgreSQL.cmake')
-rw-r--r-- | Modules/FindPostgreSQL.cmake | 26 |
1 files 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}" ) |