diff --git a/CMakeLists.txt b/CMakeLists.txt index d00a4f9f..cf85fc4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,7 +197,7 @@ if(ENABLE_LZMA) endif(ENABLE_LZMA) if(ENABLE_ZSTD) - find_package(Zstd 1.3.6) + find_package(Zstd NAMES zstd 1.3.6) if(Zstd_FOUND) set(HAVE_LIBZSTD 1) else() @@ -301,7 +301,7 @@ foreach(LIB ${LIBS_PRIVATE}) endforeach() string(REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS}) string(REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS}) -string(REGEX REPLACE "-lZstd::Zstd" "-lzstd" LIBS ${LIBS}) +string(REGEX REPLACE "-l$,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 "-lGnuTLS::GnuTLS" "-lgnutls" LIBS ${LIBS}) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 1213fa0a..b6446cbd 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -147,7 +147,7 @@ endif() if(HAVE_LIBZSTD) target_sources(zip PRIVATE zip_algorithm_zstd.c) - target_link_libraries(zip PRIVATE Zstd::Zstd) + target_link_libraries(zip PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) endif() if(HAVE_COMMONCRYPTO) diff --git a/libzip-config.cmake.in b/libzip-config.cmake.in index 5b9aa558..f9adc538 100644 --- a/libzip-config.cmake.in +++ b/libzip-config.cmake.in @@ -1,8 +1,20 @@ @PACKAGE_INIT@ # only needed for static library, and doesn't work as-is -#include(CMakeFindDependencyMacro) -#find_dependency(ZLIB::ZLIB) +include(CMakeFindDependencyMacro) +if(@ENABLE_BZIP2@) + find_dependency(BZip2) +endif() +if(@ENABLE_LZMA@) + find_dependency(LibLZMA) +endif() +if(@ENABLE_ZSTD@) + find_dependency(zstd) +endif() +if(@ENABLE_OPENSSL@) + find_dependency(OpenSSL) +endif() +find_dependency(ZLIB) # how to handle the optional dependencies? # Provide all our library targets to users. include("${CMAKE_CURRENT_LIST_DIR}/libzip-targets.cmake")