From cc2203c75d0e2872f14ca67596c5eb205f99f142 Mon Sep 17 00:00:00 2001 From: Ilya Orlov Date: Sat, 6 Oct 2018 16:00:43 +0300 Subject: [PATCH] xrCore: add to CMake getting git branch and revision for log output --- src/xrCore/CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/xrCore/CMakeLists.txt b/src/xrCore/CMakeLists.txt index 4fe125698b3..1bb5ed3cbc1 100644 --- a/src/xrCore/CMakeLists.txt +++ b/src/xrCore/CMakeLists.txt @@ -23,8 +23,23 @@ include_directories( ${SDL_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ) +execute_process(COMMAND git rev-parse --verify HEAD + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_SHA1 + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) -add_definitions(-DXRCORE_EXPORTS) +message( "commit: " ${GIT_SHA1}) + +execute_process(COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_BRANCH + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + +message( "branch: " ${GIT_BRANCH} ) + +add_definitions(-DXRCORE_EXPORTS -DGIT_INFO_CURRENT_COMMIT="${GIT_SHA1}" -DGIT_INFO_CURRENT_BRANCH="${GIT_BRANCH}") add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES}) set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")