Skip to content
Snippets Groups Projects
Commit edccc331 authored by Marcus Asteborg's avatar Marcus Asteborg Committed by Ralph Giles
Browse files

cmake - add warning flags for clang, gcc etc.

parent 982e83a7
No related branches found
No related tags found
No related merge requests found
......@@ -78,3 +78,15 @@ else()
check_flag(STACK_PROTECTOR -fstack-protector-strong)
check_flag(HIDDEN_VISIBILITY -fvisibility=hidden)
endif()
if(NOT MSVC)
set(WARNING_LIST -Wall -W -Wstrict-prototypes -Wextra -Wcast-align -Wnested-externs -Wshadow)
include(CheckCCompilerFlag)
foreach(WARNING_FLAG ${WARNING_LIST})
string(REPLACE - "" WARNING_VAR ${WARNING_FLAG})
check_c_compiler_flag(${WARNING_FLAG} ${WARNING_VAR}_SUPPORTED)
if(${WARNING_VAR}_SUPPORTED)
add_compile_options(${WARNING_FLAG})
endif()
endforeach()
endif()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment