Fixing generated GenerateBuildVersion.vcxproj when one builds on different

locale than english. The problem is that date and time CLI utilities
generates different format so that REGEX in CMake does not work.
This commit is contained in:
Tomas Kolda 2016-01-24 20:41:29 +01:00
parent d20915d52a
commit d7f22b6d25

View File

@ -30,10 +30,9 @@ cmake_minimum_required(VERSION 2.6)
project(rocksdb) project(rocksdb)
include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc) include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc)
execute_process(COMMAND powershell -Command "Get-Date -format MM_dd_yyyy" OUTPUT_VARIABLE DATE)
execute_process(COMMAND $ENV{COMSPEC} " /C date /T" OUTPUT_VARIABLE DATE) execute_process(COMMAND powershell -Command "Get-Date -format HH:mm:ss" OUTPUT_VARIABLE TIME)
execute_process(COMMAND $ENV{COMSPEC} " /C time /T" OUTPUT_VARIABLE TIME) string(REGEX REPLACE "(..)_(..)_..(..).*" "\\1/\\2/\\3" DATE ${DATE})
string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" DATE ${DATE})
string(REGEX REPLACE "(..):(.....).*" " \\1:\\2" TIME ${TIME}) string(REGEX REPLACE "(..):(.....).*" " \\1:\\2" TIME ${TIME})
string(CONCAT GIT_DATE_TIME ${DATE} ${TIME}) string(CONCAT GIT_DATE_TIME ${DATE} ${TIME})