From c6b600d62373744efa9d30493fe131eb4b89e21c Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 2 Oct 2022 00:20:02 +0200 Subject: [PATCH] cmake: Strip prefix from debug info Paves the way for some extra reproducibility. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41d0087..f6a283d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,12 @@ add_compile_options(-g) # optimizations if(CMAKE_CROSSCOMPILING) + # Reproducible build support + add_link_options(-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=) + add_link_options(-fdebug-prefix-map=${CMAKE_BINARY_DIR}=) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "8") + add_compile_options(-ffile-prefix-map=${CMAKE_SOURCE_DIR}=) + endif() # default optimization flags set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")