Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAntenore Gatta <antenore@simbiosi.org>2016-02-01 12:12:12 +0300
committerAntenore Gatta <antenore@simbiosi.org>2016-02-01 12:12:12 +0300
commit215eb7dc3dafe78c08cc2a6011047194be260c9c (patch)
tree154432080656bc8ce15b794f401782349e8761e5 /cmake
parent14f4a1ef79924343bd58a532ceabe5c1faa5335b (diff)
Makes GetGitRevisionDescription behaves correcthly when used outside the source tree
Diffstat (limited to 'cmake')
-rw-r--r--cmake/GetGitRevisionDescription.cmake10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake
index 432149d30..5e0847b27 100644
--- a/cmake/GetGitRevisionDescription.cmake
+++ b/cmake/GetGitRevisionDescription.cmake
@@ -40,8 +40,7 @@ set(__get_git_revision_description YES)
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
-
- set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}")
+ set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
@@ -54,6 +53,13 @@ function(get_git_head_revision _refspecvar _hashvar)
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
+ # check if this is a submodule
+ if(NOT IS_DIRECTORY ${GIT_DIR})
+ file(READ ${GIT_DIR} submodule)
+ string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
+ get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
+ get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
+ endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")