]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
cmake: Add ENABLE_ZSTD option 1124/head
authorMichał Górny <mgorny@gentoo.org>
Tue, 22 Jan 2019 06:52:11 +0000 (07:52 +0100)
committerMichał Górny <mgorny@gentoo.org>
Tue, 22 Jan 2019 06:52:11 +0000 (07:52 +0100)
CMakeLists.txt

index 81aa1aebe738d6150b707d6ddeea9b9b5eec993a..a381a4c9427b4b2d29ea6abe9ff2f04bf2863c9a 100644 (file)
@@ -183,6 +183,7 @@ OPTION(ENABLE_LIBB2 "Enable the use of the system LIBB2 library if found" ON)
 OPTION(ENABLE_LZ4 "Enable the use of the system LZ4 library if found" ON)
 OPTION(ENABLE_LZO "Enable the use of the system LZO library if found" OFF)
 OPTION(ENABLE_LZMA "Enable the use of the system LZMA library if found" ON)
+OPTION(ENABLE_ZSTD "Enable the use of the system zstd library if found" ON)
 
 OPTION(ENABLE_ZLIB "Enable the use of the system ZLIB library if found" ON)
 OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON)
@@ -569,15 +570,19 @@ MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY)
 #
 # Find Zstd
 #
-IF (ZSTD_INCLUDE_DIR)
-  # Already in cache, be silent
-  SET(ZSTD_FIND_QUIETLY TRUE)
-ENDIF (ZSTD_INCLUDE_DIR)
+IF(ENABLE_ZSTD)
+  IF (ZSTD_INCLUDE_DIR)
+    # Already in cache, be silent
+    SET(ZSTD_FIND_QUIETLY TRUE)
+  ENDIF (ZSTD_INCLUDE_DIR)
 
-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_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)
+ELSE(ENABLE_ZSTD)
+  SET(ZSTD_FOUND FALSE) # Override cached value
+ENDIF(ENABLE_ZSTD)
 IF(ZSTD_FOUND)
   SET(HAVE_ZSTD_H 1)
   INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR})