Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Make the build reproducible with g++-8 and clang-10

Make the build reproducible by removing references to the source
directory from the Catch2WithMain static library.
Commit
bed285af07607a9da93892f8b08d36c3fd6af98d
Author
Mathieu Mirmont ·
Committer
Martin Hořeňovský
Parents
de6fe184a9ac

Files · Download .tar.gz

Changes

 CMakeLists.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d57dd1a..05acead3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,6 +108,11 @@ add_library(Catch2WithMain ${CMAKE_CURRENT_LIST_DIR}/src/catch_with_main.cpp)
 target_link_libraries(Catch2WithMain PUBLIC Catch2)
 add_library(Catch2::Catch2WithMain ALIAS Catch2WithMain)
 
+# Make the build reproducible on versions of g++ and clang that supports -ffile-prefix-map
+if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8) OR
+   ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 10))
+  target_compile_options(Catch2WithMain PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")
+endif()
 
 # Only perform the installation steps when Catch is not being used as
 # a subproject via `add_subdirectory`, or the destinations will break,