Use cmake TIMESTAMP function
Summary: because it is not only platform independent but also allows to override the build date This helps to make ceph builds reproducible (that includes a fork of rockdb in a submodule) Also adds UTC flag, to be independent of timezone. Requires cmake-2.8.11+ from 2013 Closes https://github.com/facebook/rocksdb/pull/2848 Differential Revision: D5820189 Pulled By: yiwu-arbug fbshipit-source-id: e3e8c1550e10e238c173f6c5d9ba15f71ad3ce28
This commit is contained in:
parent
2d30aaae47
commit
82860bd55c
@ -32,7 +32,7 @@
|
||||
# 3. cmake ..
|
||||
# 4. make -j
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
project(rocksdb)
|
||||
|
||||
if(POLICY CMP0042)
|
||||
@ -98,17 +98,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
execute_process(COMMAND powershell -noprofile -Command "Get-Date -format MM_dd_yyyy" OUTPUT_VARIABLE DATE)
|
||||
execute_process(COMMAND powershell -noprofile -Command "Get-Date -format HH:mm:ss" OUTPUT_VARIABLE TIME)
|
||||
string(REGEX REPLACE "(..)_(..)_..(..).*" "\\1/\\2/\\3" DATE "${DATE}")
|
||||
string(REGEX REPLACE "(..):(.....).*" " \\1:\\2" TIME "${TIME}")
|
||||
set(GIT_DATE_TIME "${DATE} ${TIME}")
|
||||
else()
|
||||
execute_process(COMMAND date "+%Y/%m/%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
|
||||
string(REGEX REPLACE "\n" "" DATETIME ${DATETIME})
|
||||
set(GIT_DATE_TIME "${DATETIME}")
|
||||
endif()
|
||||
string(TIMESTAMP GIT_DATE_TIME "%Y/%m/%d %H:%M:%S" UTC)
|
||||
|
||||
find_package(Git)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user