X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=cmake%2FQuasselMacros.cmake;h=7ab4901c3bcac3cb029824c640947a51c87ba5e2;hp=9f576cd7aa8f259769a488a5361989a23623abca;hb=d9c471f91a6c31863e9fe805a5575ec3a308e7bc;hpb=353acdfb3bc68ba15e94061d8942c90b1c61ed61 diff --git a/cmake/QuasselMacros.cmake b/cmake/QuasselMacros.cmake index 9f576cd7..7ab4901c 100644 --- a/cmake/QuasselMacros.cmake +++ b/cmake/QuasselMacros.cmake @@ -262,3 +262,19 @@ function(target_link_if_exists _target) endforeach() endif() endfunction() + +################################################################################################### +# process_cmake_cxx_flags() +# +# Append the options declared CMAKE_CXX_FLAGS and CMAKE_CXX_FLAGS_ to the global +# compile options. +# Unset the variables afterwards to avoid duplication. +# +function(process_cmake_cxx_flags) + string(TOUPPER ${CMAKE_BUILD_TYPE} upper_build_type) + set(cxx_flags "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${upper_build_type}}") + separate_arguments(sep_cxx_flags UNIX_COMMAND ${cxx_flags}) + add_compile_options(${sep_cxx_flags}) + set(CMAKE_CXX_FLAGS "" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS_${upper_build_type} "" PARENT_SCOPE) +endfunction()