summaryrefslogtreecommitdiffstats
path: root/CMakeScripts
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-10-12 13:56:14 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-10-12 13:56:14 +0000
commit09319f688e10d47f9fc9be2b6feb831fb132660a (patch)
tree99b6c5d03da1136ebee2e1c3028f330099e49e05 /CMakeScripts
parentUpdate DefineDependsandFlags.cmake (diff)
downloadinkscape-09319f688e10d47f9fc9be2b6feb831fb132660a.tar.gz
inkscape-09319f688e10d47f9fc9be2b6feb831fb132660a.zip
CMake: Avoid reordering CMAKE_CXX_FLAGS
Order matters; the reordering caused the _FORTIFY_SOURCE flag to be always undefined (as we flipped a "-U" and "-D") Also skip removing duplicates to avoid similar pitfalls (we kept only the first occurrence but should've kept the last) It did not work properly anyway (we still had duplicates in the end) and was only required as we wrote the final CMAKE_CXX_FLAGS back to cache and consequently appended new flags with every run of CMAKE.
Diffstat (limited to 'CMakeScripts')
-rw-r--r--CMakeScripts/CanonicalizeFlagsVar.cmake11
-rw-r--r--CMakeScripts/DefineDependsandFlags.cmake28
2 files changed, 17 insertions, 22 deletions
diff --git a/CMakeScripts/CanonicalizeFlagsVar.cmake b/CMakeScripts/CanonicalizeFlagsVar.cmake
deleted file mode 100644
index ddc5b7b5d..000000000
--- a/CMakeScripts/CanonicalizeFlagsVar.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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()
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake
index 996100b4d..9dd7f7785 100644
--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -2,6 +2,7 @@ set(INKSCAPE_LIBS "")
set(INKSCAPE_INCS "")
set(INKSCAPE_INCS_SYS "")
set(INKSCAPE_CXX_FLAGS "")
+set(INKSCAPE_CXX_FLAGS_DEBUG "")
list(APPEND INKSCAPE_INCS ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/src
@@ -98,7 +99,7 @@ list(APPEND INKSCAPE_INCS_SYS ${INKSCAPE_DEP_INCLUDE_DIRS})
add_definitions(${INKSCAPE_DEP_CFLAGS_OTHER})
find_package(DoubleConversion REQUIRED) # lib2geom dependency
-
+
if(WITH_JEMALLOC)
find_package(JeMalloc)
if (JEMALLOC_FOUND)
@@ -369,14 +370,6 @@ sanitize_ldflags_for_libs(SIGC++_LDFLAGS)
list(APPEND INKSCAPE_LIBS ${SIGC++_LDFLAGS})
list(APPEND INKSCAPE_CXX_FLAGS ${SIGC++_CFLAGS_OTHER})
-list(REMOVE_DUPLICATES INKSCAPE_CXX_FLAGS)
-foreach(flag ${INKSCAPE_CXX_FLAGS})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" CACHE STRING "" FORCE)
-endforeach()
-foreach(flag ${INKSCAPE_CXX_FLAGS_DEBUG})
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag}" CACHE STRING "" FORCE)
-endforeach()
-
# Some linkers, like gold, don't find symbols recursively. So we have to link against X11 explicitly
find_package(X11)
if(X11_FOUND)
@@ -386,14 +379,27 @@ endif(X11_FOUND)
# end Dependencies
+
+
+# Set include directories and CXX flags
+# (INKSCAPE_LIBS are set as target_link_libraries for inkscape_base in src/CMakeLists.txt)
+
+foreach(flag ${INKSCAPE_CXX_FLAGS})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+endforeach()
+foreach(flag ${INKSCAPE_CXX_FLAGS_DEBUG})
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag}")
+endforeach()
+
list(REMOVE_DUPLICATES INKSCAPE_LIBS)
list(REMOVE_DUPLICATES INKSCAPE_INCS_SYS)
-# C/C++ Flags
include_directories(${INKSCAPE_INCS})
include_directories(SYSTEM ${INKSCAPE_INCS_SYS})
-include(${CMAKE_CURRENT_LIST_DIR}/ConfigChecks.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/ConfigChecks.cmake) # TODO: Check if this needs to be "hidden" here
unset(INKSCAPE_INCS)
unset(INKSCAPE_INCS_SYS)
+unset(INKSCAPE_CXX_FLAGS)
+unset(INKSCAPE_CXX_FLAGS_DEBUG)