Skip to content

Commit

Permalink
Fixed CMake git branch detection with build dir outside of repository…
Browse files Browse the repository at this point in the history
… working dir
  • Loading branch information
krzys-h committed Jun 25, 2014
1 parent 76d01b4 commit 2b9abf2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ if(DEFINED COLOBOT_VERSION_UNRELEASED)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
find_package(Git)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(COLOBOT_VERSION_UNRELEASED "${COLOBOT_VERSION_UNRELEASED}-git-${GIT_BRANCH}~r${GIT_REVISION}")
Expand Down

0 comments on commit 2b9abf2

Please sign in to comment.