1 1.1 christos include(CheckCCompilerFlag) 2 1.1 christos 3 1.1 christos macro(add_compiler_flags) 4 1.1 christos foreach(flag ${ARGN}) 5 1.1 christos string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${flag}") 6 1.1 christos 7 1.1 christos check_c_compiler_flag("${flag}" check_c_compiler_flag_${_flag_esc}) 8 1.1 christos 9 1.1 christos if (check_c_compiler_flag_${_flag_esc}) 10 1.1 christos set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") 11 1.1 christos endif() 12 1.1 christos endforeach() 13 1.1 christos endmacro() 14