2783: Don't insert timestamps into PEs with MinGW r=def- a=heinrich5991

Should make the build reproducible.

Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
bors[bot] 2020-09-08 12:15:45 +00:00 committed by GitHub
commit 21a51ff64b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -172,11 +172,15 @@ if(NOT MSVC)
# Inaccurate floating point numbers cause problems on mingw-w64-gcc when
# compiling for x86, might cause problems elsewhere. So don't store floats
# in registers but keep them at higher accuracy.
if(TARGET_ARCH STREQUAL "x86")
add_c_compiler_flag_if_supported(OUR_FLAGS -ffloat-store)
endif()
# Don't insert timestamps into PEs to keep the build reproducible.
if(TARGET_OS STREQUAL "windows")
add_c_compiler_flag_if_supported(OUR_FLAGS_LINK -Wl,--no-insert-timestamp)
endif()
if(TARGET_OS STREQUAL "mac")
add_c_compiler_flag_if_supported(OUR_FLAGS -stdlib=libc++)
endif()
@ -2516,6 +2520,9 @@ foreach(target ${TARGETS})
target_compile_options(${target} PRIVATE /GS) # Protect the stack pointer.
target_compile_options(${target} PRIVATE /wd4996) # Use of non-_s functions.
endif()
if(OUR_FLAGS_LINK)
target_link_libraries(${target} ${OUR_FLAGS_LINK})
endif()
if(OUR_FLAGS)
target_compile_options(${target} PRIVATE ${OUR_FLAGS})
endif()