Skip to content

Commit 217d320

Browse files
chore(core): prevent building tests if there are warnings
This way we can get early warnings in our CI without disrupting downstream users by adding -Wall -Werror etc if they do not wish to do so.
1 parent 56f4102 commit 217d320

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/test/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,12 @@ target_link_libraries(unit_tests
1818
GTest::gtest_main
1919
)
2020

21+
# Treat warnings as errors for tests to catch issues early
22+
if(MSVC)
23+
target_compile_options(unit_tests PRIVATE /W4 /WX)
24+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
25+
target_compile_options(unit_tests PRIVATE -Wall -Wextra -Werror)
26+
endif()
27+
2128
include(GoogleTest)
2229
gtest_discover_tests(unit_tests)

0 commit comments

Comments
 (0)