mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 13:25:41 +02:00
Make the static library build reproducible with supported compilers
This is based on bed285af07
from
`v2.x` branch, but done properly for the build in v3 branch,
effectively porting #2141 to devel.
This commit is contained in:
@@ -77,3 +77,13 @@ function(add_warnings_to_targets targets)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Adds flags required for reproducible build to the target
|
||||
# Currently only supports GCC and Clang
|
||||
function(add_build_reproducibility_settings target)
|
||||
# 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(${target} PRIVATE "-ffile-prefix-map=${CATCH_DIR}=.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
Reference in New Issue
Block a user