From 1adb9333fcdbaa2971e673b55bb131e52c8f4f27 Mon Sep 17 00:00:00 2001
From: Arnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Date: Mon, 16 Dec 2019 13:03:40 +0100
Subject: Use -ffile-prefix-map with gcc >= 8.0.

See https://github.com/simgrid/simgrid/issues/39

diff --git a/tools/cmake/Flags.cmake b/tools/cmake/Flags.cmake
index e752365d85..b23c24ede7 100644
--- a/tools/cmake/Flags.cmake
+++ b/tools/cmake/Flags.cmake
@@ -98,7 +98,11 @@ if(CMAKE_COMPILER_IS_GNUCC)
     message(WARNING "Failed to find relative source directory. Using \".\".")
     set(RELATIVE_SOURCE_DIR ".")
   endif()
-  set(optCFLAGS "${optCFLAGS} -fdebug-prefix-map=${CMAKE_SOURCE_DIR}=${RELATIVE_SOURCE_DIR}")
+  if (CMAKE_C_COMPILER_VERSION VERSION_LESS "8.0")
+    set(optCFLAGS "${optCFLAGS} -fdebug-prefix-map=${CMAKE_SOURCE_DIR}=${RELATIVE_SOURCE_DIR}")
+  else()
+    set(optCFLAGS "${optCFLAGS} -ffile-prefix-map=${CMAKE_SOURCE_DIR}=${RELATIVE_SOURCE_DIR}")
+  endif()
 endif()
 
 # Configure LTO
