CrucibleEnableCompilerWarnings.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
include_guard(GLOBAL) function(crucible_enable_compiler_warnings TARGET_NAME) get_target_property(TARGET_TYPE "${TARGET_NAME}" TYPE) if(TARGET_TYPE STREQUAL INTERFACE_LIBRARY) return() endif() target_compile_options("${TARGET_NAME}" PRIVATE $<$<CXX_COMPILER_ID:AppleClang>:-Wall -Wextra -Werror> $<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Werror> $<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Werror> $<$<CXX_COMPILER_ID:MSVC>:/W4 /WX> # msvc: disable warning c4180 (ignored const qualifier) because we const _everything_ $<$<CXX_COMPILER_ID:MSVC>:/wd4180> # msvc: disable warning c4702 (unreachable code) because it falsely assumes `if constexpr` checks will _always_ be # discarded if they are discarded for _any_ instantiation of a template $<$<CXX_COMPILER_ID:MSVC>:/wd4702>) endfunction()