diff options
author | Kefu Chai <kchai@redhat.com> | 2020-04-08 03:57:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 03:57:04 +0200 |
commit | ce84ee7856cccac3c8be6cf85bf6e1e4785857e9 (patch) | |
tree | 0d2fbc4e848f72d637a18d25943d2f8554196b29 /cmake | |
parent | Merge pull request #34383 from matthewoliver/older-tox (diff) | |
parent | cmake: really stop at top of source code tree (diff) | |
download | ceph-ce84ee7856cccac3c8be6cf85bf6e1e4785857e9.tar.xz ceph-ce84ee7856cccac3c8be6cf85bf6e1e4785857e9.zip |
Merge pull request #34369 from smithfarm/wip-43895
cmake: really stop at top of source code tree
Reviewed-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/GetGitRevisionDescription.cmake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmake/modules/GetGitRevisionDescription.cmake b/cmake/modules/GetGitRevisionDescription.cmake index 40a42015a7d..34106b64dbb 100644 --- a/cmake/modules/GetGitRevisionDescription.cmake +++ b/cmake/modules/GetGitRevisionDescription.cmake @@ -42,11 +42,12 @@ get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) function(get_git_head_revision _refspecvar _hashvar) set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(GIT_DIR "${GIT_PARENT_DIR}/.git") + set(TOP_LEVEL_DIR "${CMAKE_SOURCE_DIR}") while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) - if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) - # We have reached the root directory, we are not in git + if(GIT_PARENT_DIR STREQUAL TOP_LEVEL_DIR) + # We have reached the top of the source tree, we are not in git set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) return() |