From 227197cc5b1b7bed4fd635a893edde52ee3e9a98 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Sun, 19 Nov 2023 11:53:55 +0100 Subject: [PATCH] Omit BUILD_HOST_NAME for reproducible builds Distributions that want reproducible builds, set the SOURCE_DATE_EPOCH environment variable. In this case, we should not record the build host name to allow for bit-identical rebuilds elsewhere. This patch was done while working on reproducible builds for openSUSE. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c9341be..06598efd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,11 @@ execute_process( ) message("GIT_BRANCH: ${GIT_BRANCH}") -cmake_host_system_information(RESULT BUILD_HOST_NAME QUERY HOSTNAME) +if($ENV{SOURCE_DATE_EPOCH}) + set(BUILD_HOST_NAME "reproduciblebuild") +else () + cmake_host_system_information(RESULT BUILD_HOST_NAME QUERY HOSTNAME) +endif() if(${CMAKE_VERSION} VERSION_GREATER "3.22.0") cmake_host_system_information(RESULT BUILD_HOST_DISTRI QUERY DISTRIB_PRETTY_NAME) else ()