summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-05-15 19:52:40 +0200
committerPatrick Steinhardt <ps@pks.im>2020-05-15 19:57:09 +0200
commitb85eefb4604d3ca6983bf80e7dc9d1cedde072fd (patch)
treeb56915ccb39b903a1c286204719f0cdad691a76a /cmake
parent51a2bc4337c9ca7ff398add3f6b85ce974b4a8ac (diff)
downloadlibgit2-b85eefb4604d3ca6983bf80e7dc9d1cedde072fd.tar.gz
cmake: Sort source files for reproducible buildspks/cmake-sort-reproducible-builds
We currently use `FILE(GLOB ...)` in most places to find source and header files. This is problematic in that the order of files returned depends on the operating system's directory iteration order and may thus not be deterministic. As a result, we link object files in unspecified order, which may cause the linker to emit different code across runs. Fix this issue by sorting all code used as input to the libgit2 library to improve the reliability of reproducible builds.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/SelectHashes.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmake/Modules/SelectHashes.cmake b/cmake/Modules/SelectHashes.cmake
index 27059db6f..06672ab03 100644
--- a/cmake/Modules/SelectHashes.cmake
+++ b/cmake/Modules/SelectHashes.cmake
@@ -56,4 +56,6 @@ ELSE()
MESSAGE(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
ENDIF()
+list(SORT SRC_SHA1)
+
ADD_FEATURE_INFO(SHA ON "using ${USE_SHA1}")