37 lines
905 B
CMake
37 lines
905 B
CMake
function(kubbe_apply_warnings target)
|
|
set(_kubbe_gnu_clang_warnings
|
|
-Wall
|
|
-Wextra
|
|
-Wpedantic
|
|
-Wconversion
|
|
-Wsign-conversion
|
|
-Wshadow
|
|
-Wformat=2
|
|
-Wundef
|
|
-Wnon-virtual-dtor
|
|
-Wold-style-cast
|
|
-Woverloaded-virtual
|
|
-Wnull-dereference
|
|
-Wdouble-promotion
|
|
)
|
|
|
|
set(_kubbe_msvc_warnings /W4 /permissive- /Zc:preprocessor)
|
|
|
|
target_compile_options(
|
|
${target}
|
|
INTERFACE
|
|
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:${_kubbe_gnu_clang_warnings}>
|
|
$<$<CXX_COMPILER_ID:MSVC>:${_kubbe_msvc_warnings}>
|
|
)
|
|
|
|
if(KUBBE_WARNINGS_AS_ERRORS)
|
|
target_compile_options(
|
|
${target}
|
|
INTERFACE
|
|
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Werror>
|
|
$<$<CXX_COMPILER_ID:MSVC>:/WX>
|
|
)
|
|
endif()
|
|
endfunction()
|
|
|