2020-11-14 05:59:23 +08:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2022-05-18 14:57:24 +08:00
|
|
|
index d49db1b82..cbc2b7102 100644
|
2020-11-14 05:59:23 +08:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2022-05-18 14:57:24 +08:00
|
|
|
@@ -476,6 +476,8 @@ ENDIF()
|
2022-03-01 02:25:31 +08:00
|
|
|
IF(LIBLZMA_FOUND)
|
2020-11-14 05:59:23 +08:00
|
|
|
SET(HAVE_LIBLZMA 1)
|
|
|
|
SET(HAVE_LZMA_H 1)
|
|
|
|
+ LIST(APPEND ADDITIONAL_LIBS LibLZMA::LibLZMA)
|
2022-03-01 02:25:31 +08:00
|
|
|
+elseif(0)
|
|
|
|
CMAKE_PUSH_CHECK_STATE()
|
|
|
|
INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS})
|
|
|
|
LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES})
|
2022-05-18 14:57:24 +08:00
|
|
|
@@ -556,27 +558,15 @@ ENDIF(LIBB2_FOUND)
|
|
|
|
# Find LZ4
|
|
|
|
#
|
|
|
|
IF(ENABLE_LZ4)
|
|
|
|
- IF (LZ4_INCLUDE_DIR)
|
|
|
|
- # Already in cache, be silent
|
|
|
|
- SET(LZ4_FIND_QUIETLY TRUE)
|
|
|
|
- ENDIF (LZ4_INCLUDE_DIR)
|
|
|
|
-
|
2020-11-14 05:59:23 +08:00
|
|
|
- FIND_PATH(LZ4_INCLUDE_DIR lz4.h)
|
|
|
|
- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4)
|
|
|
|
- INCLUDE(FindPackageHandleStandardArgs)
|
|
|
|
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR)
|
|
|
|
+ FIND_PACKAGE(lz4 CONFIG REQUIRED)
|
|
|
|
ELSE(ENABLE_LZ4)
|
|
|
|
SET(LZ4_FOUND FALSE) # Override cached value
|
|
|
|
ENDIF(ENABLE_LZ4)
|
2022-05-18 14:57:24 +08:00
|
|
|
IF(LZ4_FOUND)
|
2020-11-17 01:49:38 +08:00
|
|
|
+ SET(HAVE_LZ4HC_H 1)
|
2020-11-14 05:59:23 +08:00
|
|
|
SET(HAVE_LIBLZ4 1)
|
|
|
|
SET(HAVE_LZ4_H 1)
|
|
|
|
- CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
|
|
|
|
- SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR})
|
|
|
|
- CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H)
|
|
|
|
- CMAKE_POP_CHECK_STATE() # Restore the state of the variables
|
|
|
|
- INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR})
|
|
|
|
- LIST(APPEND ADDITIONAL_LIBS ${LZ4_LIBRARY})
|
|
|
|
+ LIST(APPEND ADDITIONAL_LIBS lz4::lz4)
|
|
|
|
#
|
|
|
|
# TODO: test for static library.
|
|
|
|
#
|
2022-05-18 14:57:24 +08:00
|
|
|
@@ -587,31 +577,19 @@ MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY)
|
|
|
|
# Find Zstd
|
|
|
|
#
|
|
|
|
IF(ENABLE_ZSTD)
|
|
|
|
- IF (ZSTD_INCLUDE_DIR)
|
|
|
|
- # Already in cache, be silent
|
|
|
|
- SET(ZSTD_FIND_QUIETLY TRUE)
|
|
|
|
- ENDIF (ZSTD_INCLUDE_DIR)
|
|
|
|
-
|
2020-11-14 05:59:23 +08:00
|
|
|
- FIND_PATH(ZSTD_INCLUDE_DIR zstd.h)
|
|
|
|
- FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd)
|
|
|
|
- INCLUDE(FindPackageHandleStandardArgs)
|
|
|
|
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
|
|
|
|
+ FIND_PACKAGE(zstd CONFIG REQUIRED)
|
|
|
|
ELSE(ENABLE_ZSTD)
|
|
|
|
SET(ZSTD_FOUND FALSE) # Override cached value
|
|
|
|
ENDIF(ENABLE_ZSTD)
|
|
|
|
-IF(ZSTD_FOUND)
|
2022-05-18 14:57:24 +08:00
|
|
|
- SET(HAVE_ZSTD_H 1)
|
2020-11-14 05:59:23 +08:00
|
|
|
- INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR})
|
|
|
|
- LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY})
|
|
|
|
- CMAKE_PUSH_CHECK_STATE()
|
|
|
|
- SET(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY})
|
|
|
|
- SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
|
2022-05-18 14:57:24 +08:00
|
|
|
- CHECK_FUNCTION_EXISTS(ZSTD_decompressStream HAVE_LIBZSTD)
|
|
|
|
- CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD_COMPRESSOR)
|
2020-11-14 05:59:23 +08:00
|
|
|
- #
|
|
|
|
- # TODO: test for static library.
|
|
|
|
- #
|
|
|
|
- CMAKE_POP_CHECK_STATE()
|
2022-05-18 14:57:24 +08:00
|
|
|
+IF(zstd_FOUND)
|
2020-11-17 01:49:38 +08:00
|
|
|
+ SET(HAVE_LIBZSTD 1)
|
|
|
|
+ IF(TARGET zstd::libzstd_shared)
|
2022-05-18 14:57:24 +08:00
|
|
|
+ LIST(APPEND ADDITIONAL_LIBS zstd::libzstd_shared)
|
|
|
|
+ SET(CMAKE_REQUIRED_LIBRARIES zstd::libzstd_shared)
|
2020-11-17 01:49:38 +08:00
|
|
|
+ ELSE(TARGET zstd::libzstd_shared)
|
2022-05-18 14:57:24 +08:00
|
|
|
+ LIST(APPEND ADDITIONAL_LIBS zstd::libzstd_static)
|
|
|
|
+ SET(CMAKE_REQUIRED_LIBRARIES zstd::libzstd_static)
|
2020-11-17 01:49:38 +08:00
|
|
|
+ ENDIF(TARGET zstd::libzstd_shared)
|
2020-11-14 05:59:23 +08:00
|
|
|
ENDIF(ZSTD_FOUND)
|
|
|
|
MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR)
|
|
|
|
MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY)
|
2022-05-18 14:57:24 +08:00
|
|
|
@@ -783,8 +761,7 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
|
|
|
FIND_PACKAGE(OpenSSL)
|
|
|
|
IF(OPENSSL_FOUND)
|
2020-11-14 05:59:23 +08:00
|
|
|
SET(HAVE_LIBCRYPTO 1)
|
|
|
|
- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
|
|
|
- LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
|
|
|
|
+ LIST(APPEND ADDITIONAL_LIBS OpenSSL::Crypto)
|
|
|
|
ENDIF(OPENSSL_FOUND)
|
|
|
|
ELSE()
|
|
|
|
SET(OPENSSL_FOUND FALSE) # Override cached value
|
2022-05-18 14:57:24 +08:00
|
|
|
@@ -903,7 +880,7 @@ main(int argc, char **argv)
|
2020-11-14 05:59:23 +08:00
|
|
|
IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
|
|
|
|
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
|
|
|
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
|
|
|
|
- LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS)
|
2022-05-18 14:57:24 +08:00
|
|
|
+ #LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS)
|
2020-11-14 05:59:23 +08:00
|
|
|
ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
|
|
|
|
ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION})
|
|
|
|
ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM})
|