diff --git a/cmake/CXXCompilerFlags.cmake b/cmake/CXXCompilerFlags.cmake index 72fbaa86b..70e86eb5f 100644 --- a/cmake/CXXCompilerFlags.cmake +++ b/cmake/CXXCompilerFlags.cmake @@ -65,12 +65,14 @@ endif() CheckCXXFlag(-fno-omit-frame-pointer) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10) add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>) add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>) add_compile_options($<$>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>) add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>) add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>) add_compile_options($<$>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>) + endif() endif() # https://stackoverflow.com/questions/4913922/possible-problems-with-nominmax-on-visual-c diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake index 7b483f54f..ee2e6c214 100644 --- a/cmake/CompilerFlags.cmake +++ b/cmake/CompilerFlags.cmake @@ -60,12 +60,14 @@ endif() CheckCFlag(-fno-omit-frame-pointer) if (CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10) add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>) add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>) add_compile_options($<$>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>) add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>) add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>) add_compile_options($<$>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>) + endif() endif() set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "default CFLAGS")