Commit d1581592 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED unset variable before setting them again

Tentative to fix continuous script not modifying the git hash
parent c7fb3a99
......@@ -12,36 +12,42 @@
#! \inparam PATH_TO_SOURCE_DIR (required) input source directory path
#!
macro(get_git_info PATH_TO_SOURCE_DIR)
unset(CAMITK_GIT_COMMIT_COUNT)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-list HEAD --count
WORKING_DIRECTORY ${PATH_TO_SOURCE_DIR}
OUTPUT_VARIABLE CAMITK_GIT_COMMIT_COUNT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
unset(CAMITK_GIT_BRANCH)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${PATH_TO_SOURCE_DIR}
OUTPUT_VARIABLE CAMITK_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
unset(CAMITK_GIT_ABBREVIATED_HASH)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${PATH_TO_SOURCE_DIR}
OUTPUT_VARIABLE CAMITK_GIT_ABBREVIATED_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
unset(CAMITK_GIT_HASH)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%H
WORKING_DIRECTORY ${PATH_TO_SOURCE_DIR}
OUTPUT_VARIABLE CAMITK_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
unset(CAMITK_GIT_COMMITER_DATE)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%cd
WORKING_DIRECTORY ${PATH_TO_SOURCE_DIR}
OUTPUT_VARIABLE CAMITK_GIT_COMMITER_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
unset(CAMITK_ORIGIN_DEVELOP_GIT_HASH)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse origin/develop
WORKING_DIRECTORY ${PATH_TO_SOURCE_DIR}
OUTPUT_VARIABLE CAMITK_ORIGIN_DEVELOP_GIT_HASH
......@@ -51,11 +57,13 @@ macro(get_git_info PATH_TO_SOURCE_DIR)
string(SUBSTRING ${CAMITK_ORIGIN_DEVELOP_GIT_HASH} 0 8 CAMITK_ORIGIN_DEVELOP_GIT_ABBREVIATED_HASH)
if(NOT CAMITK_GIT_COMMIT_COUNT)
message(WARNING "Unable to find the commit number using git : ${GIT_EXECUTABLE}")
set(CAMITK_GIT_COMMIT_COUNT "unknown")
set(CAMITK_GIT_BRANCH "unknown")
set(CAMITK_GIT_HASH "unknown")
set(CAMITK_GIT_ABBREVIATED_HASH "unknown")
message(WARNING "Unable to find the commit number using git : ${GIT_EXECUTABLE}")
set(CAMITK_GIT_COMMIT_COUNT "unknown")
set(CAMITK_GIT_BRANCH "unknown")
set(CAMITK_GIT_HASH "unknown")
set(CAMITK_GIT_ABBREVIATED_HASH "unknown")
set(CAMITK_ORIGIN_DEVELOP_GIT_HASH "unknown")
set(CAMITK_ORIGIN_DEVELOP_GIT_ABBREVIATED_HASH "unknown")
endif()
endmacro()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment