From c79bb3e833ccbefec63440f36e7b39459904c771 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Mon, 11 Feb 2019 14:41:27 +0100 Subject: Add gcc/version check --- CMakeScripts/DefineDependsandFlags.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'CMakeScripts') diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index 7505277b5..4cb63aae8 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -21,8 +21,13 @@ list(APPEND INKSCAPE_CXX_FLAGS "-std=c++11") # Errors for common mistakes list(APPEND INKSCAPE_CXX_FLAGS "-Werror=format") # e.g.: printf("%s", std::string("foo")) list(APPEND INKSCAPE_CXX_FLAGS "-Werror=format-security") # e.g.: printf(variable); -list(APPEND INKSCAPE_CXX_FLAGS_DEBUG "-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection") - +list(APPEND INKSCAPE_CXX_FLAGS_DEBUG "-D_FORTIFY_SOURCE=2") +if (CMAKE_COMPILER_IS_GNUCC) +list(APPEND INKSCAPE_CXX_FLAGS_DEBUG "-fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables") +if(CXX_COMPILER_VERSION VERSION_GREATER 8.0) +list(APPEND INKSCAPE_CXX_FLAGS_DEBUG "-fstack-clash-protection -fcf-protection") +endif() +endif() # Define the flags for profiling if desired: if(WITH_PROFILING) set(BUILD_SHARED_LIBS off) -- cgit v1.2.3