Commit 75261ea2 authored by Bernhard M. Wiedemann's avatar Bernhard M. Wiedemann
Browse files

allow to override timestamps

for allowing reproducible builds
of cmake projects like freerdp and pocl

See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
parent a007f153
Pipeline #44138 passed with stage
......@@ -12,6 +12,11 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString,
bool utcFlag)
{
time_t currentTimeT = time(CM_NULLPTR);
std::string source_date_epoch;
cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch);
if (!source_date_epoch.empty()) {
std::stringstream(source_date_epoch) >> currentTimeT;
}
if (currentTimeT == time_t(-1)) {
return std::string();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment