freebsd-src/contrib/libevent/cmake/AddCompilerFlags.cmake
Cy Schubert b4d6d81dd1 libevent: Import libevent 2.1.12
Merge commit '5223d1d95fddcef6f9a36e264a5800bd907ade8b' into main

(cherry picked from commit b50261e21f)
2023-11-28 07:15:54 -08:00

14 lines
336 B
CMake

include(CheckCCompilerFlag)
macro(add_compiler_flags)
foreach(flag ${ARGN})
string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${flag}")
check_c_compiler_flag("${flag}" check_c_compiler_flag_${_flag_esc})
if (check_c_compiler_flag_${_flag_esc})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
endif()
endforeach()
endmacro()