diff options
author | David Cole <david.cole@kitware.com> | 2011-08-02 19:11:45 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-08-02 19:11:45 (GMT) |
commit | 737be8f6f65007bcc8cd3fa6d72288264d05e1ba (patch) | |
tree | cb3a0e64c7d62de61fdb3fa89eeb0d06f2dbe009 /Modules | |
parent | bd54141d5d098899afa36c6326811eb2230e99cf (diff) | |
parent | 825c45739d888cd5fe43875a9e0497c7b389ae70 (diff) | |
download | CMake-737be8f6f65007bcc8cd3fa6d72288264d05e1ba.zip CMake-737be8f6f65007bcc8cd3fa6d72288264d05e1ba.tar.gz CMake-737be8f6f65007bcc8cd3fa6d72288264d05e1ba.tar.bz2 |
Merge topic 'FindPostgresqlImprovements'
825c457 FindPostgreSQL: fix PATH_SUFFIXES, better output for FPHSA
e159bb5 Mark the results from find() as advanced
da1bdaf Use FPHSA(), remove unnecessary stuff and don't recommend link_directories()
217d068 More PATH_SUFFIXES for finding Postgresql and also search catalog/pg_type.h
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindPostgreSQL.cmake | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 96b6741..55f95c6 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -7,7 +7,6 @@ # ... # if( PostgreSQL_FOUND ) # include_directories(${PostgreSQL_INCLUDE_DIRS}) -# link_directories(${PostgreSQL_LIBRARY_DIRS}) # endif( PostgreSQL_FOUND ) # ... # Remember to include ${PostgreSQL_LIBRARIES} in the target_link_libraries() statement. @@ -113,12 +112,26 @@ find_path(PostgreSQL_INCLUDE_DIR # Look in other places. ${PostgreSQL_ROOT_DIRECTORIES} PATH_SUFFIXES + pgsql postgresql include # Help the user find it if we cannot. DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" ) +find_path(PostgreSQL_TYPE_INCLUDE_DIR + NAMES catalog/pg_type.h + PATHS + # Look in other places. + ${PostgreSQL_ROOT_DIRECTORIES} + PATH_SUFFIXES + pgsql/server + postgresql/server + include/server + # Help the user find it if we cannot. + DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" +) + # The PostgreSQL library. set (PostgreSQL_LIBRARY_TO_FIND pq) # Setting some more prefixes for the library @@ -138,42 +151,22 @@ find_library( PostgreSQL_LIBRARY get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) # Did we find anything? -set( PostgreSQL_FOUND 0 ) -if ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" ) - set( PostgreSQL_FOUND 1 ) -else ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" ) - if ( POSTGRES_REQUIRED ) - message( FATAL_ERROR "PostgreSQL is required. ${PostgreSQL_ROOT_DIR_MESSAGE}" ) - endif ( POSTGRES_REQUIRED ) -endif (EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" ) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PostgreSQL DEFAULT_MSG + PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR) + +set( PostgreSQL_FOUND ${POSTGRESQL_FOUND}) # Now try to get the include and library path. if(PostgreSQL_FOUND) - if(EXISTS "${PostgreSQL_INCLUDE_DIR}") - set(PostgreSQL_INCLUDE_DIRS - ${PostgreSQL_INCLUDE_DIR} - ) - endif(EXISTS "${PostgreSQL_INCLUDE_DIR}") - - if(EXISTS "${PostgreSQL_LIBRARY_DIR}") - set(PostgreSQL_LIBRARY_DIRS - ${PostgreSQL_LIBRARY_DIR} - ) - set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND}) - endif(EXISTS "${PostgreSQL_LIBRARY_DIR}") + 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(PostgreSQL_FOUND) -if(NOT PostgreSQL_FOUND) - if(NOT PostgreSQL_FIND_QUIETLY) - message(STATUS "PostgreSQL was not found. ${PostgreSQL_DIR_MESSAGE}") - else(NOT PostgreSQL_FIND_QUIETLY) - if(PostgreSQL_FIND_REQUIRED) - message(FATAL_ERROR "PostgreSQL was not found. ${PostgreSQL_DIR_MESSAGE}") - endif(PostgreSQL_FIND_REQUIRED) - endif(NOT PostgreSQL_FIND_QUIETLY) -endif(NOT PostgreSQL_FOUND) +mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY ) |