diff options
author | Allen Winter <allen.winter@kdab.com> | 2019-05-27 17:50:56 -0400 |
---|---|---|
committer | Allen Winter <allen.winter@kdab.com> | 2019-05-27 17:50:56 -0400 |
commit | e84714e9d6ec724dca889531e11fb963cadc2dba (patch) | |
tree | f66da1e321827de4fca6c21123ea10e1fc28b6e0 /cmake | |
parent | 3eeae5d03c39982c7489921b481ebf73502775d8 (diff) | |
download | libical-git-e84714e9d6ec724dca889531e11fb963cadc2dba.tar.gz |
CMakeLists.txt - new macros for C and C++ compiler flag checking
Issue#386
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/LibIcalMacrosInternal.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/modules/LibIcalMacrosInternal.cmake b/cmake/modules/LibIcalMacrosInternal.cmake new file mode 100644 index 00000000..618a8279 --- /dev/null +++ b/cmake/modules/LibIcalMacrosInternal.cmake @@ -0,0 +1,22 @@ +# CMake support macros and functions for the libical project + +include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) + +function(libical_append_if condition value) + if(${condition}) + foreach(variable ${ARGN}) + set(${variable} "${${variable}} ${value}" PARENT_SCOPE) + endforeach() + endif() +endfunction() + +macro(libical_add_cflag flag name) + check_c_compiler_flag("${flag}" "C_SUPPORTS_${name}") + libical_append_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS) +endmacro() + +macro(libical_add_cxxflag flag name) + check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${name}") + libical_append_if("CXX_SUPPORTS_${name}" "${flag}" CMAKE_CXX_FLAGS) +endmacro() |