Skip to content

Commit f615c5c

Browse files
authored
Change condition under which warning-errors are enabled
Having warnings not set to error on release-mode tests-enabled builds meant that warnings would be written into a project whilst development starts on master branch, only for these to generate errors as a surprise at the first Pull Request build.
1 parent a5ef1b3 commit f615c5c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ endfunction()
9393
if (MSVC) # MSVC supports different warning options to GCC/Clang
9494
# add_compile_options(/W4) # set warning level 4
9595
enable_cxx_compiler_flag_if_supported("/W4")
96-
# if in debug mode, enable converting all warnings to errors too
97-
if (PROJECT_BUILD_DEBUG)
96+
# if tests are enabled, enable converting all warnings to errors too
97+
if (ENABLE_TESTS)
9898
# add_compile_options(/WX)
9999
enable_cxx_compiler_flag_if_supported("/WX")
100100
endif()
@@ -114,8 +114,8 @@ else() # GCC/Clang warning option
114114
enable_cxx_compiler_flag_if_supported("-Wsign-conversion")
115115
# enable warnings about mistakes in Doxygen documentation
116116
enable_cxx_compiler_flag_if_supported("-Wdocumentation")
117-
# if in debug mode, enable converting all warnings to errors too
118-
if (PROJECT_BUILD_DEBUG)
117+
# if tests are enabled, enable converting all warnings to errors too
118+
if (ENABLE_TESTS)
119119
enable_cxx_compiler_flag_if_supported("-Werror")
120120
# exclude the following kinds of warnings from being converted into errors
121121
# unknown-pragma is useful to have as a warning but not as an error, if you have

0 commit comments

Comments
 (0)