mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-23 16:21:00 +03:00
cmake: drop redundant -lws2_32
meant for libssh2.pc
The `libssh2.pc` generator logic automatically adds `-lws2_32` while parsing `LIBSSH2_LIBS`, which contains this lib already. Then discard the duplicate. This patch introduces a change in the position of `ws2_32` within the lib list advertised via `libssh2.pc` for static builds. This order might in cases by significant, but: - libssh2 no longer links against `libssl`, which was the library also referencing `ws2_32` and breaking picky binutils `ld` linker when not passed in strict dependency order. Ref:c84745e34e
#1128 - since switching to INTERFACE targets, cmake messes up the lib order anyway, adding `OpenSSL:Crypto` last, instead of `ws2_32`. This did not seem to cause an issue so far. Ref:df0563a857
#1535 For these reasons it seems unlikely this position change could break Windows OpenSSL static gcc/ld builds relying on `libssh2.pc` for their lib list. It least no more than it was before this patch. Turns out these theories don't stand in practice and the order is broken possibly by introducing INTERFACE targets, with or without this patch. `libcrypto` (tested with LibreSSL) is in fact depending on `ws2_32`, and the `bcrypt` dependency is also causing breakage with picky binutils ld. I may try addressing it in a separate PR. Ref:33b6d5f89d
#827 Ref:31fb8860db
#811 Closes #1619
This commit is contained in:
@ -229,10 +229,6 @@ install(
|
||||
# Calculate variables for pkg-config
|
||||
set(LIBSSH2_PC_LIBS_PRIVATE "")
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND LIBSSH2_PC_LIBS_PRIVATE "-lws2_32")
|
||||
endif()
|
||||
|
||||
set(_ldflags "")
|
||||
|
||||
# Avoid getting unnecessary -L options for known system directories.
|
||||
|
Reference in New Issue
Block a user