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