mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
cmake: rework binutils ld hack to not read LOCATION property
Instead hook up the upstream target name as-is to the local wrapper
target.
To:
- make the hack work regardless of how the upstream target was created.
- make it work the same way in `curl-config.cmake`.
Before this patch it had no guard for `IMPORTED` targets even though
`find_dependencies()` is not guaranteed to create the target expected
if it already existed and was potentially created differently.
Depends-on: #20840
Follow-up to 4f1646ef8a #20486 #20419
Closes #20839
This commit is contained in:
parent
9d104f566f
commit
0793c98027
@ -42,8 +42,7 @@ if("@USE_OPENSSL@")
|
||||
# Define lib duplicate to fixup lib order for GCC binutils ld in static builds
|
||||
if(TARGET OpenSSL::Crypto AND NOT TARGET CURL::OpenSSL_Crypto)
|
||||
add_library(CURL::OpenSSL_Crypto INTERFACE IMPORTED)
|
||||
get_target_property(_curl_libname OpenSSL::Crypto LOCATION)
|
||||
set_target_properties(CURL::OpenSSL_Crypto PROPERTIES INTERFACE_LINK_LIBRARIES "${_curl_libname}")
|
||||
set_target_properties(CURL::OpenSSL_Crypto PROPERTIES INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
|
||||
endif()
|
||||
endif()
|
||||
if("@HAVE_LIBZ@")
|
||||
@ -51,8 +50,7 @@ if("@HAVE_LIBZ@")
|
||||
# Define lib duplicate to fixup lib order for GCC binutils ld in static builds
|
||||
if(TARGET ZLIB::ZLIB AND NOT TARGET CURL::ZLIB)
|
||||
add_library(CURL::ZLIB INTERFACE IMPORTED)
|
||||
get_target_property(_curl_libname ZLIB::ZLIB LOCATION)
|
||||
set_target_properties(CURL::ZLIB PROPERTIES INTERFACE_LINK_LIBRARIES "${_curl_libname}")
|
||||
set_target_properties(CURL::ZLIB PROPERTIES INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@ -1843,22 +1843,14 @@ endif()
|
||||
# to consume libcurl, regardless of the compiler used to build libcurl itself.
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
if(USE_OPENSSL AND TARGET OpenSSL::Crypto)
|
||||
get_target_property(_curl_imported OpenSSL::Crypto IMPORTED)
|
||||
if(_curl_imported)
|
||||
add_library(CURL::OpenSSL_Crypto INTERFACE IMPORTED)
|
||||
get_target_property(_curl_libname OpenSSL::Crypto LOCATION)
|
||||
set_target_properties(CURL::OpenSSL_Crypto PROPERTIES INTERFACE_LINK_LIBRARIES "${_curl_libname}")
|
||||
list(APPEND CURL_LIBS CURL::OpenSSL_Crypto)
|
||||
endif()
|
||||
add_library(CURL::OpenSSL_Crypto INTERFACE IMPORTED)
|
||||
set_target_properties(CURL::OpenSSL_Crypto PROPERTIES INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
|
||||
list(APPEND CURL_LIBS CURL::OpenSSL_Crypto)
|
||||
endif()
|
||||
if(HAVE_LIBZ AND TARGET ZLIB::ZLIB)
|
||||
get_target_property(_curl_imported ZLIB::ZLIB IMPORTED)
|
||||
if(_curl_imported)
|
||||
add_library(CURL::ZLIB INTERFACE IMPORTED)
|
||||
get_target_property(_curl_libname ZLIB::ZLIB LOCATION)
|
||||
set_target_properties(CURL::ZLIB PROPERTIES INTERFACE_LINK_LIBRARIES "${_curl_libname}")
|
||||
list(APPEND CURL_LIBS CURL::ZLIB)
|
||||
endif()
|
||||
add_library(CURL::ZLIB INTERFACE IMPORTED)
|
||||
set_target_properties(CURL::ZLIB PROPERTIES INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||
list(APPEND CURL_LIBS CURL::ZLIB)
|
||||
endif()
|
||||
if(WIN32)
|
||||
add_library(CURL::win32_winsock INTERFACE IMPORTED)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user