commit 6d16d5e: [Minor] Make compiling with backward-cpp optional

Duncan Bellamy dunk at denkimushi.com
Thu Oct 12 14:14:03 UTC 2023


Author: Duncan Bellamy
Date: 2023-10-12 08:47:32 +0000
URL: https://github.com/rspamd/rspamd/commit/6d16d5e9ef7bcd0e5c3cd841d1a5df139f301463

[Minor] Make compiling with backward-cpp optional

---
 CMakeLists.txt | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e78a7ebfb..9f9c807e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,6 +60,7 @@ OPTION(ENABLE_LIBUNWIND "Obsoleted [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(ENABLE_FASTTEXT "Link with FastText library [default: OFF]" OFF)
+OPTION(ENABLE_BACKWARD "Build rspamd with backward-cpp stacktrace [default: ON]" ON)
 OPTION(SYSTEM_ZSTD "Use system zstd instead of bundled one [default: OFF]" OFF)
 OPTION(SYSTEM_FMT "Use system fmt instead of bundled one [default: OFF]" OFF)
 OPTION(SYSTEM_DOCTEST "Use system doctest instead of bundled one [default: OFF]" OFF)
@@ -625,11 +626,18 @@ ADD_SUBDIRECTORY(contrib/libev)
 ADD_SUBDIRECTORY(contrib/kann)
 ADD_SUBDIRECTORY(contrib/fastutf8)
 ADD_SUBDIRECTORY(contrib/google-ced)
-ADD_SUBDIRECTORY(contrib/backward-cpp)
-message(STATUS "Backward-cpp config: ${BACKWARD_DEFINITIONS}")
-if (BACKWARD_LIBRARIES)
+IF (ENABLE_BACKWARD MATCHES "ON")
+    ADD_SUBDIRECTORY(contrib/backward-cpp)
+    message(STATUS "Backward-cpp config: ${BACKWARD_DEFINITIONS}")
+ELSE ()
+    set(BACKWARD_ENABLE)
+    macro(add_backward target)
+      # do nothing
+    endmacro()
+ENDIF ()
+IF (BACKWARD_LIBRARIES)
     message(STATUS "Backward-cpp libraries: ${BACKWARD_LIBRARIES}")
-endif()
+ENDIF ()
 
 IF (SYSTEM_FMT MATCHES "OFF")
     INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/contrib/fmt/include")


More information about the Commits mailing list