diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2020-12-28 18:16:15 +0100 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-01-04 14:36:59 -0500 |
commit | f254e67bf664805f8312bcfb3cc97d209110e183 (patch) | |
tree | 5933da3a15fb7d87c0feba112964ec4abea6daa1 /Modules/FindPostgreSQL.cmake | |
parent | 6b1adada4c1b9f5d682484a07e90d68765f8a7d4 (diff) | |
download | cmake-f254e67bf664805f8312bcfb3cc97d209110e183.tar.gz |
FindPostgreSQL: Do not require pg_type.h
In systems where PostgreSQL has separate developer packages for
server and client libraries `PostgreSQL_TYPE_INCLUDE_DIR` is not
specified. According to initial logic server part was not required
but was accidentally added to `REQUIRED_VARS` during the migration to
`find_package_handle_standard_args`.
Fixes: #17223
Diffstat (limited to 'Modules/FindPostgreSQL.cmake')
-rw-r--r-- | Modules/FindPostgreSQL.cmake | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index cd50d8c047..911210f136 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -247,7 +247,7 @@ endif() # Did we find anything? include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(PostgreSQL - REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR + REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR VERSION_VAR PostgreSQL_VERSION_STRING) set(PostgreSQL_FOUND ${POSTGRESQL_FOUND}) @@ -271,16 +271,19 @@ endfunction() # Now try to get the include and library path. if(PostgreSQL_FOUND) + set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR}) + if(PostgreSQL_TYPE_INCLUDE_DIR) + list(APPEND PostgreSQL_INCLUDE_DIRS ${PostgreSQL_TYPE_INCLUDE_DIR}) + endif() + set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} ) if (NOT TARGET PostgreSQL::PostgreSQL) add_library(PostgreSQL::PostgreSQL UNKNOWN IMPORTED) set_target_properties(PostgreSQL::PostgreSQL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIR};${PostgreSQL_TYPE_INCLUDE_DIR}") + INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIRS}") __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "") __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "RELEASE") __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "DEBUG") endif () - set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} ) - set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} ) endif() mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR) |