cmake: avoid de-duplication of user's CXXFLAGS
[quassel.git] / cmake / QuasselMacros.cmake
index 077e59a..9ba0003 100644 (file)
@@ -1,6 +1,6 @@
 # This file contains various functions and macros useful for building Quassel.
 #
-# (C) 2014-2020 by the Quassel Project <devel@quassel-irc.org>
+# (C) 2014-2022 by the Quassel Project <devel@quassel-irc.org>
 #
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
@@ -410,8 +410,12 @@ endfunction()
 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})
+    if(CMAKE_VERSION VERSION_LESS 3.12)
+        separate_arguments(sep_cxx_flags UNIX_COMMAND ${cxx_flags})
+        add_compile_options(${sep_cxx_flags})
+    else()
+        add_compile_options("SHELL:${cxx_flags}")
+    endif()
     set(CMAKE_CXX_FLAGS "" PARENT_SCOPE)
     set(CMAKE_CXX_FLAGS_${upper_build_type} "" PARENT_SCOPE)
 endfunction()