2020-01-13 10:24:35 +00:00
|
|
|
include (CheckCXXCompilerFlag)
|
2020-01-10 10:25:14 +00:00
|
|
|
|
|
|
|
# Try to add -Wflag if compiler supports it
|
|
|
|
macro (add_warning flag)
|
|
|
|
string (REPLACE "-" "_" underscored_flag ${flag})
|
|
|
|
string (REPLACE "+" "x" underscored_flag ${underscored_flag})
|
|
|
|
check_cxx_compiler_flag("-W${flag}" SUPPORTS_FLAG_${underscored_flag})
|
|
|
|
if (SUPPORTS_FLAG_${underscored_flag})
|
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W${flag}")
|
|
|
|
else ()
|
|
|
|
message (WARNING "Flag -W${flag} is unsupported")
|
|
|
|
endif ()
|
2020-01-10 16:36:36 +00:00
|
|
|
endmacro ()
|
2020-01-10 10:25:14 +00:00
|
|
|
|
|
|
|
# Try to add -Wno flag if compiler supports it
|
|
|
|
macro (no_warning flag)
|
|
|
|
add_warning(no-${flag})
|
2020-01-10 16:36:36 +00:00
|
|
|
endmacro ()
|