From 53034c0a7a245957d2f9a7663db625e69c6040ba Mon Sep 17 00:00:00 2001 From: Duncan Bellamy Date: Sun, 23 May 2021 12:57:58 +0100 Subject: [PATCH] [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) -- 2.39.5