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