Failing on any compile warning is very useful in CI builds,
so add an option for enabling this. The option defaults to OFF,
because we don't want to annoy users that don't want this.
Enable fatal warnings in Travis CI.
-GNinja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING=ON \
+ -DFATAL_WARNINGS=ON \
&& ninja install \
&& ccache -s \
&& ctest -VV \
endif()
# The following options are not for end-user consumption, so don't list them in the feature summary
+option(FATAL_WARNINGS "Make compile warnings fatal (most useful for CI builds)" OFF)
cmake_dependent_option(DEPLOY "Add required libs to bundle resources and create a dmg" OFF "APPLE" OFF)
# List of authenticators and the cmake flags to build them
-Wundef
-Wvla
-Werror=return-type
+ "$<$<BOOL:${FATAL_WARNINGS}>:-Werror>"
-Wno-unknown-pragmas
"$<$<NOT:$<CONFIG:Debug>>:-U_FORTIFY_SOURCE;-D_FORTIFY_SOURCE=2>"
)
add_definitions(-DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -D_USE_MATH_DEFINES -DNOMINMAX)
# Compile options
- add_compile_options(/EHsc)
+ add_compile_options(
+ /EHsc
+ "$<$<BOOL:${FATAL_WARNINGS}>:/WX>"
+ )
# Increase warning level on MSVC
# CMake puts /W3 in CMAKE_CXX_FLAGS which will be appended later, so we need to replace