vcpkg/ports/libzip/use-requires.patch
Alexander Neumann a5eb9209cd
[libzip] fix pc file (#33157)
* [libzip] fix pkgconfig

* v db

* CR. Use Requires.private

Co-authored-by: Kai Pastor <dg0yt@darc.de>

* v db

* fix lzma pc name

* v db

---------

Co-authored-by: Kai Pastor <dg0yt@darc.de>
2023-08-16 13:01:24 -07:00

85 lines
2.8 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf85fc4b7..90615fec9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,12 +41,14 @@ endif()
if(ENABLE_GNUTLS)
find_package(Nettle 3.0)
find_package(GnuTLS)
+ list(APPEND REQUIRES nettle)
endif()
if(ENABLE_MBEDTLS)
find_package(MbedTLS 1.0)
endif()
if(ENABLE_OPENSSL)
find_package(OpenSSL)
+ list(APPEND REQUIRES openssl)
endif()
if(WIN32)
if(ENABLE_WINDOWS_CRYPTO)
@@ -177,7 +179,7 @@ int main(int argc, char *argv[]) { }" HAVE_NULLABLE)
test_big_endian(WORDS_BIGENDIAN)
find_package(ZLIB 1.1.2 REQUIRED)
-
+list(APPEND REQUIRES zlib)
if(ENABLE_BZIP2)
find_package(BZip2)
if(BZIP2_FOUND)
@@ -185,6 +187,7 @@ if(ENABLE_BZIP2)
else()
message(WARNING "-- bzip2 library not found; bzip2 support disabled")
endif(BZIP2_FOUND)
+ list(APPEND REQUIRES bzip2)
endif(ENABLE_BZIP2)
if(ENABLE_LZMA)
@@ -194,6 +197,7 @@ if(ENABLE_LZMA)
else()
message(WARNING "-- lzma library not found; lzma/xz support disabled")
endif(LIBLZMA_FOUND)
+ list(APPEND REQUIRES liblzma)
endif(ENABLE_LZMA)
if(ENABLE_ZSTD)
@@ -203,6 +207,7 @@ if(ENABLE_ZSTD)
else()
message(WARNING "-- zstd library not found; zstandard support disabled")
endif(Zstd_FOUND)
+ list(APPEND REQUIRES libzstd)
endif(ENABLE_ZSTD)
if (COMMONCRYPTO_FOUND)
@@ -299,13 +304,14 @@ foreach(LIB ${LIBS_PRIVATE})
endif()
set(LIBS "${LIBS} -l${LIB}")
endforeach()
-string(REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS})
-string(REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS})
-string(REGEX REPLACE "-l$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>" "-lzstd" LIBS ${LIBS})
-string(REGEX REPLACE "-lOpenSSL::Crypto" "-lssl -lcrypto" LIBS ${LIBS})
-string(REGEX REPLACE "-lZLIB::ZLIB" "-lz" LIBS ${LIBS})
+string(REGEX REPLACE "-lBZip2::BZip2" "" LIBS ${LIBS})
+string(REGEX REPLACE "-lLibLZMA::LibLZMA" "" LIBS ${LIBS})
+string(REGEX REPLACE "-l$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>" "" LIBS ${LIBS})
+string(REGEX REPLACE "-lOpenSSL::Crypto" "" LIBS ${LIBS})
+string(REGEX REPLACE "-lZLIB::ZLIB" "" LIBS ${LIBS})
string(REGEX REPLACE "-lGnuTLS::GnuTLS" "-lgnutls" LIBS ${LIBS})
string(REGEX REPLACE "-lNettle::Nettle" "-lnettle" LIBS ${LIBS})
+list(JOIN REQUIRES " " REQUIRES)
configure_file(libzip.pc.in libzip.pc @ONLY)
if(LIBZIP_DO_INSTALL)
install(FILES ${PROJECT_BINARY_DIR}/libzip.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
diff --git a/libzip.pc.in b/libzip.pc.in
index d51b0ab63..755685c03 100644
--- a/libzip.pc.in
+++ b/libzip.pc.in
@@ -9,6 +9,7 @@ zipcmp=${bindir}/zipcmp
Name: libzip
Description: library for handling zip archives
Version: @PROJECT_VERSION@
+Requires.private: @REQUIRES@
Libs: @PKG_CONFIG_RPATH@ -L${libdir} -lzip
Libs.private: @LIBS@
Cflags: -I${includedir}