Skip to content

Commit

Permalink
Tests: use add_compile_options() to add warnings to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Nov 2, 2024
1 parent 6be08bb commit cd191b6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -14,12 +22,6 @@ add_executable(apitests apitests.cpp)

add_executable(noexceptionstests noexceptionstests.cpp)



target_compile_options(${PROJECT_NAME} INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:/W4>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Wconversion>)

target_compile_options(noexceptionstests PUBLIC -fno-exceptions)

set_target_properties(negative apitests noexceptionstests
Expand Down

0 comments on commit cd191b6

Please sign in to comment.