EnableCompilerWarnings.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
include_guard(GLOBAL) function(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>) endfunction()