mirror of
https://github.com/nlohmann/json.git
synced 2026-10-04 05:30:31 +00:00
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 <mail@nlohmann.me>
30 lines
1.0 KiB
CMake
30 lines
1.0 KiB
CMake
# common build settings
|
|
add_library(abi_compat_common INTERFACE)
|
|
target_compile_definitions(abi_compat_common INTERFACE
|
|
DOCTEST_CONFIG_SUPER_FAST_ASSERTS
|
|
JSON_TEST_KEEP_MACROS)
|
|
target_compile_features(abi_compat_common INTERFACE cxx_std_11)
|
|
target_compile_options(abi_compat_common INTERFACE
|
|
$<$<CXX_COMPILER_ID:MSVC>:/EHsc>
|
|
# MSVC: Force to always compile with W4
|
|
$<$<CXX_COMPILER_ID:MSVC>:/W4;$<$<CONFIG:Release>:/wd4702>>
|
|
|
|
# https://github.com/nlohmann/json/pull/3229
|
|
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=2196>
|
|
|
|
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
|
|
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=1786>)
|
|
target_include_directories(abi_compat_common SYSTEM INTERFACE
|
|
../thirdparty/doctest
|
|
include)
|
|
target_link_libraries(abi_compat_common INTERFACE ${NLOHMANN_JSON_TARGET_NAME})
|
|
|
|
# shared main()
|
|
add_library(abi_compat_main STATIC main.cpp)
|
|
target_link_libraries(abi_compat_main PUBLIC abi_compat_common)
|
|
|
|
# add individual tests
|
|
add_subdirectory(config)
|
|
add_subdirectory(diag)
|
|
add_subdirectory(inline_ns)
|