From 9f7413502cef8c1821734633683c2569bb776932 Mon Sep 17 00:00:00 2001 From: Vasili Svirski Date: Thu, 15 Oct 2015 00:47:09 +0400 Subject: [PATCH] Error while cmake by building from zip-archive * add -C ${CMAKE_CURRENT_SOURCE_DIR} to git can found revision from current source directory Tested: * configure project by CMake 3.0.0 successfully * configure project by command: cmake -G "Visual Studio 12 Win64" * build solution by Visual Studio * manually validate that file utils/build_version.cc contains valid head revision value --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8ad791e0..5f929d4fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" DATE ${DATE}) string(REGEX REPLACE "(..):(.....).*" " \\1:\\2" TIME ${TIME}) string(CONCAT GIT_DATE_TIME ${DATE} ${TIME}) -execute_process(COMMAND $ENV{COMSPEC} " /C git rev-parse HEAD 2>nil" OUTPUT_VARIABLE GIT_SHA) +execute_process(COMMAND $ENV{COMSPEC} " /C git -C ${CMAKE_CURRENT_SOURCE_DIR} rev-parse HEAD" OUTPUT_VARIABLE GIT_SHA) string(REGEX REPLACE "[^0-9a-f]+" "" GIT_SHA ${GIT_SHA}) set(BUILD_VERSION_CC ${CMAKE_CURRENT_SOURCE_DIR}/util/build_version.cc)