aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3141dff772f6..a5641ade2411 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,6 +179,7 @@ include(CTest)
OPTION(ENABLE_NETTLE "Enable use of Nettle" ON)
OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
+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)
@@ -508,6 +509,33 @@ ENDIF(LZO2_FOUND)
MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY)
#
+# Find libb2
+#
+IF(ENABLE_LIBB2)
+ IF (LIBB2_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(LIBB2_FIND_QUIETLY TRUE)
+ ENDIF (LIBB2_INCLUDE_DIR)
+
+ FIND_PATH(LIBB2_INCLUDE_DIR blake2.h)
+ FIND_LIBRARY(LIBB2_LIBRARY NAMES b2 libb2)
+ INCLUDE(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBB2 DEFAULT_MSG LIBB2_LIBRARY LIBB2_INCLUDE_DIR)
+ELSE(ENABLE_LIBB2)
+ SET(LIBB2_FOUND FALSE) # Override cached value
+ENDIF(ENABLE_LIBB2)
+IF(LIBB2_FOUND)
+ SET(HAVE_LIBB2 1)
+ SET(HAVE_BLAKE2_H 1)
+ SET(ARCHIVE_BLAKE2 FALSE)
+ LIST(APPEND ADDITIONAL_LIBS ${LIBB2_LIBRARY})
+ SET(CMAKE_REQUIRED_LIBRARIES ${LIBB2_LIBRARY})
+ SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR})
+ CHECK_FUNCTION_EXISTS(blake2sp_init HAVE_LIBB2)
+ELSE(LIBB2_FOUND)
+ SET(ARCHIVE_BLAKE2 TRUE)
+ENDIF(LIBB2_FOUND)
+#
# Find LZ4
#
IF(ENABLE_LZ4)