mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +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
|
# a function to get the Git checkout hash and store it in a variable
|
||||||
function(KATIE_GIT_CHECKOUT OUTSTR)
|
function(KATIE_GIT_CHECKOUT OUTSTR)
|
||||||
find_program(git NAMES git)
|
find_program(git NAMES git)
|
||||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT git)
|
||||||
set(${OUTSTR} "unknown" PARENT_SCOPE)
|
|
||||||
elseif(NOT git)
|
|
||||||
message(WARNING "Git was not found, unable to obtain checkout.\n")
|
message(WARNING "Git was not found, unable to obtain checkout.\n")
|
||||||
set(${OUTSTR} "unknown" PARENT_SCOPE)
|
else(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||||
else()
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND "${git}" rev-parse HEAD
|
COMMAND "${git}" rev-parse HEAD
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
@ -157,7 +154,6 @@ function(KATIE_GIT_CHECKOUT OUTSTR)
|
||||||
|
|
||||||
if(NOT git_result STREQUAL 0)
|
if(NOT git_result STREQUAL 0)
|
||||||
message(WARNING "Git command failed, unable to obtain checkout:\n${git_output}")
|
message(WARNING "Git command failed, unable to obtain checkout:\n${git_output}")
|
||||||
set(${OUTSTR} "unknown" PARENT_SCOPE)
|
|
||||||
else()
|
else()
|
||||||
set(${OUTSTR} "${git_output}" PARENT_SCOPE)
|
set(${OUTSTR} "${git_output}" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Add table
Reference in a new issue