mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-13 12:59:55 -05:00
FindPostgreSQL: Fix regression in computation of library directory
Since commit 368bcba28a (FindPostgreSQL: Find debug lib, imported
configs, 2019-05-09, v3.15.0-rc1~93^2) the `PostgreSQL_LIBRARY` variable
may contain a list and therefore should not be passed to the
`get_filename_component` command directly. Instead spell out the logic
to compute `PostgreSQL_LIBRARY_DIR` from one of the per-configuration
variables.
Fixes: #19444
This commit is contained in:
@@ -172,14 +172,21 @@ endfunction()
|
|||||||
# any PostgreSQL_LIBRARY that is already specified and skip the search.
|
# any PostgreSQL_LIBRARY that is already specified and skip the search.
|
||||||
if(PostgreSQL_LIBRARY)
|
if(PostgreSQL_LIBRARY)
|
||||||
set(PostgreSQL_LIBRARIES "${PostgreSQL_LIBRARY}")
|
set(PostgreSQL_LIBRARIES "${PostgreSQL_LIBRARY}")
|
||||||
|
get_filename_component(PostgreSQL_LIBRARY_DIR "${PostgreSQL_LIBRARY}" PATH)
|
||||||
else()
|
else()
|
||||||
__postgresql_find_library(PostgreSQL_LIBRARY_RELEASE ${PostgreSQL_LIBRARY_TO_FIND})
|
__postgresql_find_library(PostgreSQL_LIBRARY_RELEASE ${PostgreSQL_LIBRARY_TO_FIND})
|
||||||
__postgresql_find_library(PostgreSQL_LIBRARY_DEBUG ${PostgreSQL_LIBRARY_TO_FIND}d)
|
__postgresql_find_library(PostgreSQL_LIBRARY_DEBUG ${PostgreSQL_LIBRARY_TO_FIND}d)
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
||||||
select_library_configurations(PostgreSQL)
|
select_library_configurations(PostgreSQL)
|
||||||
mark_as_advanced(PostgreSQL_LIBRARY_RELEASE PostgreSQL_LIBRARY_DEBUG)
|
mark_as_advanced(PostgreSQL_LIBRARY_RELEASE PostgreSQL_LIBRARY_DEBUG)
|
||||||
|
if(PostgreSQL_LIBRARY_RELEASE)
|
||||||
|
get_filename_component(PostgreSQL_LIBRARY_DIR "${PostgreSQL_LIBRARY_RELEASE}" PATH)
|
||||||
|
elseif(PostgreSQL_LIBRARY_DEBUG)
|
||||||
|
get_filename_component(PostgreSQL_LIBRARY_DIR "${PostgreSQL_LIBRARY_DEBUG}" PATH)
|
||||||
|
else()
|
||||||
|
set(PostgreSQL_LIBRARY_DIR "")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
|
|
||||||
|
|
||||||
if (PostgreSQL_INCLUDE_DIR)
|
if (PostgreSQL_INCLUDE_DIR)
|
||||||
# Some platforms include multiple pg_config.hs for multi-lib configurations
|
# Some platforms include multiple pg_config.hs for multi-lib configurations
|
||||||
|
|||||||
Reference in New Issue
Block a user