summaryrefslogtreecommitdiff
path: root/libs/libevent/docs/cmake/AddCompilerFlags.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libevent/docs/cmake/AddCompilerFlags.cmake')
-rw-r--r--libs/libevent/docs/cmake/AddCompilerFlags.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/libevent/docs/cmake/AddCompilerFlags.cmake b/libs/libevent/docs/cmake/AddCompilerFlags.cmake
new file mode 100644
index 0000000000..c7da188b7a
--- /dev/null
+++ b/libs/libevent/docs/cmake/AddCompilerFlags.cmake
@@ -0,0 +1,15 @@
+include(CheckCCompilerFlag)
+
+macro(add_compiler_flags _flags)
+ foreach(flag ${_flags})
+ 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()
+
+