Fix branch name for AppVeyor Builds (#3472)

This commit is contained in:
Zion 2017-09-22 03:26:43 -07:00 committed by Ivan
parent c6e6f4afea
commit 8e66e719fa
1 changed files with 11 additions and 6 deletions

View File

@ -19,12 +19,17 @@ if(GIT_FOUND AND EXISTS "${SOURCE_DIR}/../.git/")
if(NOT ${exit_code} EQUAL 0) if(NOT ${exit_code} EQUAL 0)
message(WARNING "git rev-parse failed, unable to include version.") message(WARNING "git rev-parse failed, unable to include version.")
endif() endif()
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD # Hack fix for AppVeyor (Pull Requests don't generate a branch name)
WORKING_DIRECTORY ${SOURCE_DIR} if(NOT DEFINED ENV{APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH})
RESULT_VARIABLE exit_code execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE GIT_BRANCH) WORKING_DIRECTORY ${SOURCE_DIR}
if(NOT ${exit_code} EQUAL 0) RESULT_VARIABLE exit_code
message(WARNING "git rev-parse failed, unable to include git branch.") OUTPUT_VARIABLE GIT_BRANCH)
if(NOT ${exit_code} EQUAL 0)
message(WARNING "git rev-parse failed, unable to include git branch.")
endif()
else()
set(GIT_BRANCH $ENV{APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH})
endif() endif()
string(STRIP ${GIT_VERSION} GIT_VERSION) string(STRIP ${GIT_VERSION} GIT_VERSION)
string(STRIP ${GIT_VERSION_} GIT_VERSION_) string(STRIP ${GIT_VERSION_} GIT_VERSION_)