Skip to content

Commit

Permalink
use cmake TIMESTAMP
Browse files Browse the repository at this point in the history
to make build more platform-independent
and to allow to override build date to enable reproducible builds

See https://reproducible-builds.org/ for why this is good.

Also use UTC to be independent of timezones.
  • Loading branch information
bmwiedemann committed Sep 11, 2017
1 parent cf87de9 commit 29a0865
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)

project(Cadabra)
Expand All @@ -17,7 +17,7 @@ endif()
if(GIT_COMMIT_DATE)
set(CADABRA_VERSION_DATE "${GIT_COMMIT_DATE}")
else()
execute(COMMAND date -I OUTPUT_VARIABLE THE_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
string(TIMESTAMP THE_DATE "%Y-%m-%d" UTC)
set(CADABRA_VERSION_DATE "${THE_DATE}")
endif()
message("-- Building ${CADABRA_VERSION_MAJOR}.${CADABRA_VERSION_MINOR}.${CADABRA_VERSION_PATCH}")
Expand Down

0 comments on commit 29a0865

Please sign in to comment.