1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-01-06 14:21:57 +03:00

cmake: (re-)add zlib to Libs.private in libssh2.pc

We mistakently added transitive zlib to `Requires.private` before, then
removed it. This patch re-adds zlib, but this time to `Libs.private`,
which is listing raw libs and should include transitive libs as well.

Also add zlib when used as a direct dependency when zlib compression
support is enabled.

Follow-up to ef538069a6

Closes #1131
This commit is contained in:
Viktor Szakats
2023-07-23 14:31:39 +00:00
parent 83910b724c
commit 6464301820
2 changed files with 4 additions and 0 deletions

View File

@@ -334,6 +334,7 @@ if(CRYPTO_BACKEND STREQUAL "OpenSSL" OR NOT CRYPTO_BACKEND)
if(ZLIB_FOUND)
list(APPEND LIBRARIES ${ZLIB_LIBRARIES})
list(APPEND LIBSSH2_PC_LIBS_PRIVATE -lz)
endif()
endif()
endif()
@@ -360,6 +361,7 @@ if(CRYPTO_BACKEND STREQUAL "wolfSSL" OR NOT CRYPTO_BACKEND)
if(ZLIB_FOUND)
list(APPEND CRYPTO_BACKEND_INCLUDE_DIR ${ZLIB_INCLUDE_DIR}) # Public wolfSSL headers require zlib headers
list(APPEND LIBRARIES ${ZLIB_LIBRARIES})
list(APPEND LIBSSH2_PC_LIBS_PRIVATE -lz)
endif()
endif()
endif()

View File

@@ -58,6 +58,7 @@ if(ENABLE_ZLIB_COMPRESSION)
list(APPEND libssh2_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
list(APPEND LIBRARIES ${ZLIB_LIBRARIES})
list(APPEND LIBSSH2_PC_LIBS_PRIVATE -lz)
list(APPEND LIBSSH2_PC_REQUIRES_PRIVATE zlib)
if(ZLIB_FOUND)
list(APPEND libssh2_DEFINITIONS LIBSSH2_HAVE_ZLIB)
@@ -184,6 +185,7 @@ if(LIBSSH2_PC_REQUIRES_PRIVATE)
string(REPLACE ";" "," LIBSSH2_PC_REQUIRES_PRIVATE "${LIBSSH2_PC_REQUIRES_PRIVATE}")
endif()
if(LIBSSH2_PC_LIBS_PRIVATE)
list(REMOVE_DUPLICATES LIBSSH2_PC_LIBS_PRIVATE)
string(REPLACE ";" " " LIBSSH2_PC_LIBS_PRIVATE "${LIBSSH2_PC_LIBS_PRIVATE}")
endif()
# merge the pkg-config private fields into public ones when static-only