summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Eberl <moritz@semiodesk.com>2016-04-16 17:26:13 +0000
committerMoritz Eberl <moritz@semiodesk.com>2016-04-16 17:26:13 +0000
commitb477775db77e179940a0580321d9ae6240006433 (patch)
treee321f023cd2fd33517b2b539b53c4867183f7edd
parentmerge and fixed build (diff)
parentCXX flags dedup on CMake builds (diff)
downloadinkscape-b477775db77e179940a0580321d9ae6240006433.tar.gz
inkscape-b477775db77e179940a0580321d9ae6240006433.zip
Merge
(bzr r14761.1.12)
-rw-r--r--CMakeLists.txt8
-rw-r--r--CMakeScripts/CanonicalizeFlagsVar.cmake11
2 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 641aec8ac..3a181ca04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -211,6 +211,14 @@ if(WITH_GTEST)
add_subdirectory(test EXCLUDE_FROM_ALL)
endif()
+# Canonicalize the flags to speed up recompilation using ccache/etc.
+# This should be the last thing we do:
+include(CMakeScripts/CanonicalizeFlagsVar.cmake)
+canonicalize_flags_var("${CMAKE_CXX_FLAGS}" _new_cxx)
+set(CMAKE_CXX_FLAGS "${_new_cxx}" CACHE STRING "" FORCE)
+# message(FATAL_ERROR "CMAKE_CXX_FLAGS = <${CMAKE_CXX_FLAGS}>")
+
+
# ----------------------------------------------------------------------
# Information Summary
# ----------------------------------------------------------------------
diff --git a/CMakeScripts/CanonicalizeFlagsVar.cmake b/CMakeScripts/CanonicalizeFlagsVar.cmake
new file mode 100644
index 000000000..ddc5b7b5d
--- /dev/null
+++ b/CMakeScripts/CanonicalizeFlagsVar.cmake
@@ -0,0 +1,11 @@
+# This file is copyright by Shlomi Fish, 2016.
+#
+# This file is licensed under the MIT/X11 license:
+# https://opensource.org/licenses/mit-license.php
+
+macro (canonicalize_flags_var in_val out_var)
+ string(REPLACE " " ";" _c "${in_val}")
+ list(REMOVE_DUPLICATES _c)
+ list(SORT _c)
+ string(REPLACE ";" " " "${out_var}" "${_c}")
+endmacro()