Skip to content

Commit

Permalink
Test with -Werror
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed Feb 15, 2024
1 parent 3d34b75 commit 15e206f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
integration
)

set(
all_targets
demo
integration
)

set(
unit_test_sources
tests/unit/constexpr_contexts.cpp
Expand All @@ -68,6 +74,7 @@ if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
)
foreach(test_file ${unit_test_sources})
get_filename_component(test_name ${test_file} NAME_WE)
list(APPEND all_targets ${test_name})
add_executable(${test_name} ${test_file})
target_link_libraries(${test_name} libassert-lib)
add_test(NAME ${test_name} COMMAND ${test_name})
Expand All @@ -85,4 +92,14 @@ if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
)
endforeach(target ${dsym_targets})
endif()

foreach(target ${all_targets})
target_compile_options(
${target_name}
PRIVATE
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Werror=return-type -Wshadow -Wundef -Werror>
$<$<CXX_COMPILER_ID:GNU>:-Wuseless-cast -Wnonnull-compare>
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX /permissive->
)
endforeach()
endif()

0 comments on commit 15e206f

Please sign in to comment.