vcpkg/ports/libpq/vcpkg-cmake-wrapper.cmake
ras0219 de299679d9
[libpq] Fix incidental linkage of DL on windows platforms. (#14172)
Previously, detecting the presence of the dlfcn-win32 library resulted in an incorrect `-ldl` injection.

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-10-22 21:56:51 -07:00

18 lines
586 B
CMake

# Give the CMake module a little bit of help to find the debug libraries
find_library(PostgreSQL_LIBRARY_DEBUG
NAMES pq
PATHS
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib"
NO_DEFAULT_PATH
)
_find_package(${ARGS})
if(PostgreSQL_FOUND AND @USE_DL@)
find_library(PostgreSQL_DL_LIBRARY NAMES dl)
if(PostgreSQL_DL_LIBRARY)
list(APPEND PostgreSQL_LIBRARIES "dl")
if(TARGET PostgreSQL::PostgreSQL)
set_property(TARGET PostgreSQL::PostgreSQL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dl")
endif()
endif()
endif()