Skip to content

Commit

Permalink
Use cmake TIMESTAMP function
Browse files Browse the repository at this point in the history
to allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
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.

Also use UTC to be independent of timezone.
  • Loading branch information
bmwiedemann authored and alanxz committed Dec 22, 2020
1 parent 219efb1 commit 283c197
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/CMakeLists.txt
Expand Up @@ -45,9 +45,10 @@ if (BUILD_TOOLS_DOCS)

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
set(XMLTO_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doc/man-date.ent)
STRING(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
add_custom_command(
OUTPUT ${XMLTO_DEPENDS}
COMMAND date +'%Y-%m-%d' > ${XMLTO_DEPENDS}
COMMAND echo ${BUILD_DATE} > ${XMLTO_DEPENDS}
VERBATIM
)

Expand Down

0 comments on commit 283c197

Please sign in to comment.