mirror of
https://github.com/curl/curl.git
synced 2026-06-22 04:45:38 +03:00
curl-config.cmake.in: add logic
This commit is contained in:
parent
e25a3c6734
commit
4a143771e0
1 changed files with 16 additions and 0 deletions
|
|
@ -45,6 +45,22 @@ if(NOT TARGET @PROJECT_NAME@::@LIB_NAME@)
|
|||
add_library(@PROJECT_NAME@::@LIB_NAME@ ALIAS @PROJECT_NAME@::@LIB_SELECTED@)
|
||||
endif()
|
||||
|
||||
cmake_policy(GET CMP0099 _has_CMP0099) # https://cmake.org/cmake/help/latest/policy/CMP0099.html
|
||||
if(NOT _has_CMP0099 AND _lib)
|
||||
message(STATUS "CURL: CMP0099 not detected, resorting to workaround.")
|
||||
# CMake before CMP0099 (CMake 3.17 2020-03-20) did not endorse the concept of libdirs and lib names.
|
||||
# It expected libs to have an absolute filename. As a workaround, manually apply dependency libdirs
|
||||
# to the libcurl target, for CMake consumers without this policy set.
|
||||
get_target_property(_libdirs "${_lib}" INTERFACE_LINK_DIRECTORIES)
|
||||
if(_libdirs)
|
||||
foreach(_target IN ITEMS @PROJECT_NAME@::@LIB_SHARED@ @PROJECT_NAME@::@LIB_STATIC@)
|
||||
if(TARGET "${_target}")
|
||||
target_link_directories("${_target}" INTERFACE ${_libdirs})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For compatibility with CMake's FindCURL.cmake
|
||||
set(CURL_VERSION_STRING "@CURLVERSION@")
|
||||
set(CURL_LIBRARIES @PROJECT_NAME@::@LIB_NAME@)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue