commit 53034c0: [Feature] add SYSTEM_ZSTD cmake option To use the system zstd instead on the bundled version

Duncan Bellamy dunk at denkimushi.com
Mon May 24 10:35:04 UTC 2021


Author: Duncan Bellamy
Date: 2021-05-23 12:57:58 +0100
URL: https://github.com/rspamd/rspamd/commit/53034c0a7a245957d2f9a7663db625e69c6040ba (refs/pull/3764/head)

[Feature] add SYSTEM_ZSTD cmake option To use the system zstd instead on the bundled version

---
 CMakeLists.txt     | 8 +++++++-
 src/CMakeLists.txt | 6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9706637e0..a0800ee0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,6 +57,7 @@ OPTION(ENABLE_UTILS        "Build rspamd internal utils [default: OFF]" OFF)
 OPTION(ENABLE_LIBUNWIND    "Use libunwind to print crash traces [default: OFF]" OFF)
 OPTION(ENABLE_LUA_TRACE    "Trace all Lua C API invocations [default: OFF]" OFF)
 OPTION(ENABLE_LUA_REPL     "Enables Lua repl (requires C++11 compiler) [default: ON]" ON)
+OPTION(SYSTEM_ZSTD         "Use system zstd instead of bundled one [default: OFF]" OFF)
 
 ############################# INCLUDE SECTION #############################################
 
@@ -625,7 +626,12 @@ ADD_SUBDIRECTORY(contrib/http-parser)
 ADD_SUBDIRECTORY(contrib/fpconv)
 ADD_SUBDIRECTORY(contrib/lc-btrie)
 ADD_SUBDIRECTORY(contrib/libottery)
-ADD_SUBDIRECTORY(contrib/zstd)
+IF(SYSTEM_ZSTD MATCHES "OFF")
+	ADD_SUBDIRECTORY(contrib/zstd)
+ELSE()
+	ProcessPackage(LIBZSTD LIBRARY zstd INCLUDE zstd.h
+		ROOT ${LIBZSTD_ROOT_DIR} MODULES zstd)
+ENDIF()
 IF(ENABLE_SNOWBALL MATCHES "ON")
 	ADD_SUBDIRECTORY(contrib/snowball)
 	SET(WITH_SNOWBALL 1)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 04eae4057..903aa3159 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -194,7 +194,11 @@ TARGET_LINK_LIBRARIES(rspamd-server rspamd-fpconv)
 TARGET_LINK_LIBRARIES(rspamd-server rspamd-cdb)
 TARGET_LINK_LIBRARIES(rspamd-server rspamd-lpeg)
 TARGET_LINK_LIBRARIES(rspamd-server lcbtrie)
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-zstd)
+IF(SYSTEM_ZSTD MATCHES "OFF")
+	TARGET_LINK_LIBRARIES(rspamd-server rspamd-zstd)
+ELSE()
+	TARGET_LINK_LIBRARIES(rspamd-server zstd)
+ENDIF()
 TARGET_LINK_LIBRARIES(rspamd-server rspamd-fastutf8)
 TARGET_LINK_LIBRARIES(rspamd-server fmt)
 


More information about the Commits mailing list