X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=cmake%2FQuasselMacros.cmake;h=247b620756db6f47f6f4b1bb9e5d2e7ec176b223;hb=4baddc0de428fa9080db6987b77a861763450a3b;hp=62ad20c7c729b6604e38987fcde969f974d7f067;hpb=8f2ee00f4edef1693628d3af0bdee84d725eb754;p=quassel.git diff --git a/cmake/QuasselMacros.cmake b/cmake/QuasselMacros.cmake index 62ad20c7..247b6207 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. @@ -200,6 +200,7 @@ function(quassel_add_test _target) list(APPEND ARG_LIBRARIES Qt5::Test Quassel::Common + Quassel::Test::Global Quassel::Test::Main ) @@ -261,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()