From ddd6fdb41ef319016214fc97566eee3cf993aeb8 Mon Sep 17 00:00:00 2001 From: Force Charlie Date: Tue, 14 Jul 2020 20:56:01 +0800 Subject: [PATCH] Cleanup zstd support --- CMakeLists.txt | 7 ++----- cmake/{FindZstd.cmake => FindLibZSTD.cmake} | 12 +++++------- lib/CMakeLists.txt | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) rename cmake/{FindZstd.cmake => FindLibZSTD.cmake} (86%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 881bb791f..f4184616f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,13 +206,11 @@ endif(ENABLE_LZMA) if(ENABLE_ZSTD) find_package(LibZSTD) - if(ZSTD_FOUND) + if(LIBZSTD_FOUND) set(HAVE_LIBZSTD 1) - include_directories(${ZSTD_INCLUDE_DIR}) - set(OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} ${ZSTD_LIBRARY}) else() message(WARNING "-- zstd library not found; zstd support disabled") - endif(ZSTD_FOUND) + endif(LIBZSTD_FOUND) endif(ENABLE_ZSTD) if (COMMONCRYPTO_FOUND) @@ -310,7 +308,6 @@ foreach(LIB ${LIBS_PRIVATE}) endforeach() string(REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS}) string(REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS}) -string(REGEX REPLACE "-lLibZSTD::LibZSTD" "-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/cmake/FindZstd.cmake b/cmake/FindLibZSTD.cmake similarity index 86% rename from cmake/FindZstd.cmake rename to cmake/FindLibZSTD.cmake index 89300ddfd..8ae328afd 100644 --- a/cmake/FindZstd.cmake +++ b/cmake/FindLibZSTD.cmake @@ -29,13 +29,11 @@ include(SelectLibraryConfigurations) SELECT_LIBRARY_CONFIGURATIONS(ZSTD) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - ZSTD DEFAULT_MSG - ZSTD_LIBRARY ZSTD_INCLUDE_DIR +find_package_handle_standard_args(LibZSTD + FOUND_VAR LIBZSTD_FOUND + REQUIRED_VARS + ZSTD_LIBRARY ZSTD_INCLUDE_DIR + VERSION_VAR ZSTD_VERSION ) -if (ZSTD_FOUND) - message(STATUS "Found Zstd: ${ZSTD_LIBRARY}") -endif() - mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d51ce1ca9..d631e42a6 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -148,7 +148,7 @@ endif() if(HAVE_LIBZSTD) target_sources(zip PRIVATE zip_algorithm_zstd.c) - target_link_libraries(zip PRIVATE LibZSTD::LibZSTD) + target_link_libraries(zip PRIVATE zstd) endif() if(HAVE_COMMONCRYPTO)