Fixed issue with cmake version generation
[libevent.git] / cmake / AddCompilerFlags.cmake
blobc7da188b7a54b301dc8f24fb9018c304ee900e35
1 include(CheckCCompilerFlag)
3 macro(add_compiler_flags _flags)
4         foreach(flag ${_flags})
5                 string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${flag}")
7                 check_c_compiler_flag("${flag}" check_c_compiler_flag_${_flag_esc})
9                 if (check_c_compiler_flag_${_flag_esc})
10                         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
11                 endif()
12         endforeach()
13 endmacro()