X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=cmake%2FQuasselMacros.cmake;h=6182f704f25be501b7987220daf1f0346fb127bc;hb=5e25edca8416d89570ebce59096c1e7a93c81352;hp=9f576cd7aa8f259769a488a5361989a23623abca;hpb=cf64023910d5b42477f6158f4cee853cc7f7f3f8;p=quassel.git diff --git a/cmake/QuasselMacros.cmake b/cmake/QuasselMacros.cmake index 9f576cd7..6182f704 100644 --- a/cmake/QuasselMacros.cmake +++ b/cmake/QuasselMacros.cmake @@ -1,6 +1,6 @@ # This file contains various functions and macros useful for building Quassel. # -# (C) 2014-2018 by the Quassel Project +# (C) 2014-2019 by the Quassel Project # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. @@ -45,7 +45,7 @@ function(quassel_add_module _module) string(REPLACE "::" "_" target ${target}) string(REPLACE "_" "-" output_name ${target}) - if (ARG_STATIC) + if (ARG_STATIC OR NOT ENABLE_SHARED) set(buildmode STATIC) else() set(buildmode SHARED) @@ -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()