From d37a3764e9889e6de0a7341ba3195ee8a314de23 Mon Sep 17 00:00:00 2001 From: Petr Vaněk Date: Wed, 1 Sep 2021 13:30:56 +0200 Subject: Add SYSTEM_DOCTEST cmake option This gives packagers option to use system version of doctest rather than bundled one. It is disabled by default. Additionally, there is no need to link rspamd-test-cxx with doctest as it is is single header library. Main reason for this change is that currently bundled version of doctest-2.4.5 can't compile with glibc-2.34 [1]. However, this issue was already fixed in upstream doctest-2.4.6 [2] in commit [3]. With this, packagers can just bump doctest to fixed version. [1] https://github.com/onqtam/doctest/issues/473 [2] https://github.com/onqtam/doctest/blob/master/CHANGELOG.md#246-2021-03-22 [3] https://github.com/onqtam/doctest/commit/099d5414e97244ec44cf46b14cd176b3a3dc52e3 --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index fc4175677..ced49730d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ 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) OPTION(SYSTEM_FMT "Use system fmt instead of bundled one [defalut: OFF]" OFF) +OPTION(SYSTEM_DOCTEST "Use system doctest instead of bundled one [default: OFF]" OFF) ############################# INCLUDE SECTION ############################################# @@ -118,7 +119,6 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/" "${CMAKE_SOURCE_DIR}/contrib/lc-btrie" "${CMAKE_SOURCE_DIR}/contrib/lua-lpeg" "${CMAKE_SOURCE_DIR}/contrib/frozen/include" - "${CMAKE_SOURCE_DIR}/contrib/doctest" "${CMAKE_SOURCE_DIR}/contrib/fu2/include" "${CMAKE_BINARY_DIR}/src" #Stored in the binary dir "${CMAKE_BINARY_DIR}/src/libcryptobox") @@ -656,7 +656,12 @@ IF(SYSTEM_FMT MATCHES "OFF") ELSE() find_package(fmt) ENDIF() -ADD_SUBDIRECTORY(contrib/doctest) +IF(SYSTEM_DOCTEST MATCHES "OFF") + ADD_SUBDIRECTORY(contrib/doctest) + INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/contrib/doctest") +ELSE() + find_package(doctest) +ENDIF() IF (NOT WITH_LUAJIT) ADD_SUBDIRECTORY(contrib/lua-bit) -- cgit v1.2.3