23 lines
544 B
CMake
23 lines
544 B
CMake
# Compiler warnings configuration
|
|
function(set_project_warnings)
|
|
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
|
|
|
|
if(MSVC)
|
|
add_compile_options(
|
|
/W4
|
|
/permissive-
|
|
$<$<BOOL:${WARNINGS_AS_ERRORS}>:/WX>
|
|
)
|
|
else()
|
|
add_compile_options(
|
|
-Wall
|
|
-Wextra
|
|
-Wpedantic
|
|
-Wshadow
|
|
-Wconversion
|
|
-Wsign-conversion
|
|
$<$<BOOL:${WARNINGS_AS_ERRORS}>:-Werror>
|
|
)
|
|
endif()
|
|
endfunction()
|