Skip to content

Commit

Permalink
Cleanup zstd support
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlie committed Jul 14, 2020
1 parent e8f26d6 commit ddd6fdb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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})
Expand Down
12 changes: 5 additions & 7 deletions cmake/FindZstd.cmake → cmake/FindLibZSTD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ddd6fdb

Please sign in to comment.