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:
Viktor Szakats 2026-02-14 12:03:16 +01:00
parent 9e1e5ea67c
commit 298f73f95b
No known key found for this signature in database

View file

@ -1820,6 +1820,7 @@ endif()
# 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
# 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)
@ -1843,6 +1844,7 @@ if(WIN32)
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
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-MP") # Parallel compilation