From b13f8f4dd4b6604ba6a57f6005150c2e7b37641f Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Sat, 9 Jul 2022 11:07:46 +0200 Subject: [PATCH] Fix default build with `--disable-cpp-tests`. For a build configured with `--disable-cpp-tests` we globally set `-DDOCTEST_CONFIG_DISABLE`. Spicy does not expect this define to be used and its unit tests fail to build with it. This patch adds a Zeek-side workaround for that. We now do not build the Spicy unit test targets as part of `ALL` anymore. Closes #2238. --- auxil/spicy/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/auxil/spicy/CMakeLists.txt b/auxil/spicy/CMakeLists.txt index 050ee9753e..bae7ed6be6 100644 --- a/auxil/spicy/CMakeLists.txt +++ b/auxil/spicy/CMakeLists.txt @@ -36,3 +36,19 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla") set(HILTI_DEV_PRECOMPILE_HEADERS OFF) add_subdirectory(spicy) + +# Disable Spicy unit test targets. +# +# Spicy builds its unit tests as part of `ALL`. They are usually not only +# uninteresting for us but might cause problems. Since any configuration +# we do for our unit tests happens through global C++ compiler flags, they +# would get inherited directly by Spicy which can cause issues, e.g., we set +# `-DDOCTEST_CONFIG_DISABLE` if `ENABLE_ZEEK_UNIT_TESTS` is false, but Spicy +# unit test do not anticipate this define being set. +set_target_properties( + hilti-rt-tests + hilti-rt-configuration-tests + spicy-rt-tests + hilti-toolchain-tests + spicy-toolchain-tests + PROPERTIES EXCLUDE_FROM_ALL TRUE)