mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
cmake: enable binutils ld workaround for all toolchains at build-time (revert)
The change was valid, but caused an annoying warning with perfectly
working non-binutils ld linkers:
```
ld: warning: ignoring duplicate libraries: 'my/path/usr/local/lib/libcrypto.a'
```
(seen with Apple clang, when using static `libcrypto.a`)
It means that for the binutil ld hack to work at consumption-time, curl
must be built with the same picky binutils (gcc) toolchain.
Reverts 795433b923 #20434
Closes #20594
This commit is contained in:
parent
9e1e5ea67c
commit
298f73f95b
1 changed files with 22 additions and 20 deletions
|
|
@ -1820,28 +1820,30 @@ endif()
|
||||||
# linkers sensitive to lib order. There must be a better solution to this.
|
# linkers sensitive to lib order. There must be a better solution to this.
|
||||||
# Enable the workaround for all compilers, to make it available when using GCC
|
# Enable the workaround for all compilers, to make it available when using GCC
|
||||||
# to consume libcurl, regardless of the compiler used to build libcurl itself.
|
# to consume libcurl, regardless of the compiler used to build libcurl itself.
|
||||||
if(USE_OPENSSL AND TARGET OpenSSL::Crypto)
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
get_target_property(_curl_imported OpenSSL::Crypto IMPORTED)
|
if(USE_OPENSSL AND TARGET OpenSSL::Crypto)
|
||||||
if(_curl_imported)
|
get_target_property(_curl_imported OpenSSL::Crypto IMPORTED)
|
||||||
add_library(CURL::OpenSSL_Crypto INTERFACE IMPORTED)
|
if(_curl_imported)
|
||||||
get_target_property(_curl_libname OpenSSL::Crypto LOCATION)
|
add_library(CURL::OpenSSL_Crypto INTERFACE IMPORTED)
|
||||||
set_target_properties(CURL::OpenSSL_Crypto PROPERTIES INTERFACE_LINK_LIBRARIES "${_curl_libname}")
|
get_target_property(_curl_libname OpenSSL::Crypto LOCATION)
|
||||||
list(APPEND CURL_LIBS CURL::OpenSSL_Crypto)
|
set_target_properties(CURL::OpenSSL_Crypto PROPERTIES INTERFACE_LINK_LIBRARIES "${_curl_libname}")
|
||||||
|
list(APPEND CURL_LIBS CURL::OpenSSL_Crypto)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
if(HAVE_LIBZ AND TARGET ZLIB::ZLIB)
|
||||||
if(HAVE_LIBZ AND TARGET ZLIB::ZLIB)
|
get_target_property(_curl_imported ZLIB::ZLIB IMPORTED)
|
||||||
get_target_property(_curl_imported ZLIB::ZLIB IMPORTED)
|
if(_curl_imported)
|
||||||
if(_curl_imported)
|
add_library(CURL::ZLIB INTERFACE IMPORTED)
|
||||||
add_library(CURL::ZLIB INTERFACE IMPORTED)
|
get_target_property(_curl_libname ZLIB::ZLIB LOCATION)
|
||||||
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 "${_curl_libname}")
|
list(APPEND CURL_LIBS CURL::ZLIB)
|
||||||
list(APPEND CURL_LIBS CURL::ZLIB)
|
endif()
|
||||||
|
endif()
|
||||||
|
if(WIN32)
|
||||||
|
add_library(CURL::win32_winsock INTERFACE IMPORTED)
|
||||||
|
set_target_properties(CURL::win32_winsock PROPERTIES INTERFACE_LINK_LIBRARIES "ws2_32")
|
||||||
|
list(APPEND CURL_LIBS CURL::win32_winsock)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
if(WIN32)
|
|
||||||
add_library(CURL::win32_winsock INTERFACE IMPORTED)
|
|
||||||
set_target_properties(CURL::win32_winsock PROPERTIES INTERFACE_LINK_LIBRARIES "ws2_32")
|
|
||||||
list(APPEND CURL_LIBS CURL::win32_winsock)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # MSVC but exclude clang-cl
|
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # MSVC but exclude clang-cl
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue