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.
This commit is contained in:
Benjamin Bannier 2022-07-09 11:07:46 +02:00
parent d957f883df
commit b13f8f4dd4

View file

@ -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)