diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-05-15 19:52:40 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-05-15 19:57:09 +0200 |
commit | b85eefb4604d3ca6983bf80e7dc9d1cedde072fd (patch) | |
tree | b56915ccb39b903a1c286204719f0cdad691a76a /deps | |
parent | 51a2bc4337c9ca7ff398add3f6b85ce974b4a8ac (diff) | |
download | libgit2-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 'deps')
-rw-r--r-- | deps/http-parser/CMakeLists.txt | 7 | ||||
-rw-r--r-- | deps/ntlmclient/CMakeLists.txt | 1 | ||||
-rw-r--r-- | deps/zlib/CMakeLists.txt | 11 |
3 files changed, 11 insertions, 8 deletions
diff --git a/deps/http-parser/CMakeLists.txt b/deps/http-parser/CMakeLists.txt index 4a8bafd2f..b9da2496f 100644 --- a/deps/http-parser/CMakeLists.txt +++ b/deps/http-parser/CMakeLists.txt @@ -1,5 +1,6 @@ -FILE(GLOB SRC_HTTP "*.c" "*.h") +file(GLOB SRC_HTTP "*.c" "*.h") +list(SORT SRC_HTTP) -ADD_LIBRARY(http-parser OBJECT ${SRC_HTTP}) +add_library(http-parser OBJECT ${SRC_HTTP}) -ENABLE_WARNINGS(implicit-fallthrough=1) +enable_warnings(implicit-fallthrough=1) diff --git a/deps/ntlmclient/CMakeLists.txt b/deps/ntlmclient/CMakeLists.txt index 43d32185a..5fbf0d0f4 100644 --- a/deps/ntlmclient/CMakeLists.txt +++ b/deps/ntlmclient/CMakeLists.txt @@ -1,4 +1,5 @@ FILE(GLOB SRC_NTLMCLIENT "ntlm.c" "unicode_builtin.c" "util.c") +LIST(SORT SRC_NTLMCLIENT) ADD_DEFINITIONS(-DNTLM_STATIC=1) diff --git a/deps/zlib/CMakeLists.txt b/deps/zlib/CMakeLists.txt index afa5a19af..435877d86 100644 --- a/deps/zlib/CMakeLists.txt +++ b/deps/zlib/CMakeLists.txt @@ -1,5 +1,6 @@ -DISABLE_WARNINGS(implicit-fallthrough) -ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP) -FILE(GLOB SRC_ZLIB "*.c" "*.h") -INCLUDE_DIRECTORIES(".") -ADD_LIBRARY(zlib OBJECT ${SRC_ZLIB}) +disable_warnings(implicit-fallthrough) +add_definitions(-DNO_VIZ -DSTDC -DNO_GZIP) +file(GLOB SRC_ZLIB "*.c" "*.h") +list(SORT SRC_ZLIB) +include_directories(".") +add_library(zlib OBJECT ${SRC_ZLIB}) |