CMake: fix get_git_head_revision.
This commit is contained in:
parent
bcd89728c3
commit
da9f8078b8
@ -58,10 +58,12 @@ endfunction()
|
|||||||
function(get_git_head_revision _refspecvar _hashvar)
|
function(get_git_head_revision _refspecvar _hashvar)
|
||||||
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
|
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
|
||||||
|
|
||||||
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_CURRENT_SOURCE_DIR}" "${GIT_DIR}")
|
if (NOT GIT_DIR STREQUAL "")
|
||||||
if (_relative_to_source_dir MATCHES "^[.][.]")
|
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_CURRENT_SOURCE_DIR}" "${GIT_DIR}")
|
||||||
# We've gone above the CMake root dir.
|
if (_relative_to_source_dir MATCHES "^[.][.]")
|
||||||
set(GIT_DIR "")
|
# We've gone above the CMake root dir.
|
||||||
|
set(GIT_DIR "")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if (GIT_DIR STREQUAL "")
|
if (GIT_DIR STREQUAL "")
|
||||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||||
|
Loading…
Reference in New Issue
Block a user