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