From cd191b6c45f930db1af78b1c5d695fc5c1bf7722 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 2 Nov 2024 19:42:46 -0400 Subject: [PATCH] Tests: use add_compile_options() to add warnings to tests --- tests/CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8a00a6a..f8f5b36 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,6 +6,14 @@ add_library(${PROJECT_NAME} INTERFACE) include_directories("${PROJECT_SOURCE_DIR}/../source") +if (MSVC) + # warning level 4 + add_compile_options(/W4) +else() + # additional warnings + add_compile_options(-Wall -Wextra -Wpedantic -Wconversion) +endif() + add_executable(negative negative.cpp) add_executable(cpp11 test_cpp11.cpp) add_executable(cpp17 test_cpp17.cpp) @@ -14,12 +22,6 @@ add_executable(apitests apitests.cpp) add_executable(noexceptionstests noexceptionstests.cpp) - - -target_compile_options(${PROJECT_NAME} INTERFACE - $<$:/W4> - $<$>:-Wall -Wextra -Wpedantic -Wconversion>) - target_compile_options(noexceptionstests PUBLIC -fno-exceptions) set_target_properties(negative apitests noexceptionstests