Skip to content

Commit

Permalink
xrCore: add to CMake getting git branch and revision for log output
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Oct 6, 2018
1 parent 6e9dcd0 commit cc2203c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/xrCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit cc2203c

Please sign in to comment.