mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
do not reset KATIE_GIT variable from katie_git_checkout() macro if hash cannot be obtained
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
97b5e9416c
commit
baf03308b2
1 changed files with 2 additions and 6 deletions
|
@ -140,12 +140,9 @@ endfunction()
|
|||
# a function to get the Git checkout hash and store it in a variable
|
||||
function(KATIE_GIT_CHECKOUT OUTSTR)
|
||||
find_program(git NAMES git)
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
set(${OUTSTR} "unknown" PARENT_SCOPE)
|
||||
elseif(NOT git)
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT git)
|
||||
message(WARNING "Git was not found, unable to obtain checkout.\n")
|
||||
set(${OUTSTR} "unknown" PARENT_SCOPE)
|
||||
else()
|
||||
else(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
execute_process(
|
||||
COMMAND "${git}" rev-parse HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
|
@ -157,7 +154,6 @@ function(KATIE_GIT_CHECKOUT OUTSTR)
|
|||
|
||||
if(NOT git_result STREQUAL 0)
|
||||
message(WARNING "Git command failed, unable to obtain checkout:\n${git_output}")
|
||||
set(${OUTSTR} "unknown" PARENT_SCOPE)
|
||||
else()
|
||||
set(${OUTSTR} "${git_output}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Reference in a new issue