From 819838839d06179573da2440dacdb2ab8fee2700 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 30 Sep 2026 09:54:07 +0200 Subject: [PATCH] Include doctest as a SYSTEM directory instead of disabling warnings for all tests test_main added -Wno-deprecated and -Wno-float-equal as PUBLIC compile options for every non-MSVC compiler, so they were applied to every translation unit, library headers included, and silenced the CI warnings meant to check the library's own -Wfloat-equal pragmas. The only code that actually needed the suppression was the vendored doctest.h, which was included as a normal (non-SYSTEM) directory. Include thirdparty/doctest as SYSTEM for test_main, matching what tests/abi/CMakeLists.txt already does, and drop the two suppressions from both targets. Verified locally that unit-comparison, unit-conversions and unit-constructor1 compile clean with -Werror -Weverything and doctest as -isystem, and that CMake still configures with JSON_BuildTests=ON. Part of #5725 Signed-off-by: Niels Lohmann --- tests/CMakeLists.txt | 4 ++-- tests/abi/CMakeLists.txt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8c81b9123..78b5f1ab1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -90,11 +90,11 @@ target_compile_options(test_main PUBLIC # https://github.com/nlohmann/json/pull/3229 $<$:-diag-disable=2196> - $<$>:-Wno-deprecated;-Wno-float-equal> $<$:-Wno-deprecated-declarations> $<$:-diag-disable=1786>) +target_include_directories(test_main SYSTEM PUBLIC + thirdparty/doctest) target_include_directories(test_main PUBLIC - thirdparty/doctest thirdparty/fifo_map ${PROJECT_BINARY_DIR}/include) target_link_libraries(test_main PUBLIC ${NLOHMANN_JSON_TARGET_NAME}) diff --git a/tests/abi/CMakeLists.txt b/tests/abi/CMakeLists.txt index 542409977..c6cbfd7c1 100644 --- a/tests/abi/CMakeLists.txt +++ b/tests/abi/CMakeLists.txt @@ -12,7 +12,6 @@ target_compile_options(abi_compat_common INTERFACE # https://github.com/nlohmann/json/pull/3229 $<$:-diag-disable=2196> - $<$>:-Wno-deprecated;-Wno-float-equal> $<$:-Wno-deprecated-declarations> $<$:-diag-disable=1786>) target_include_directories(abi_compat_common SYSTEM INTERFACE