mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 02:26:16 +00:00
cmake: Fix GetGitRevisionDescription cmake module for MSys
When running in an msys environment and in a git worktree directory, the git revision is not found. This patch converts the git_worktree_dir variable to the windows format, by adding the windows prefix of the msys root dir, so that the HEAD file of the worktree can be found and used by the module.
This commit is contained in:
parent
5791c8135d
commit
e17dd0a494
|
@ -143,6 +143,16 @@ function(get_git_head_revision _refspecvar _hashvar)
|
||||||
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
||||||
${worktree_ref})
|
${worktree_ref})
|
||||||
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
||||||
|
# When running in an msys environment, the git_worktree_dir has to be
|
||||||
|
# converted to windows format, by adding the windows prefix of the
|
||||||
|
# msys root dir.
|
||||||
|
if(MINGW)
|
||||||
|
execute_process(
|
||||||
|
COMMAND bash -c "cygpath.exe -m /"
|
||||||
|
OUTPUT_VARIABLE real_root
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
set(git_worktree_dir "${real_root}${git_worktree_dir}")
|
||||||
|
endif()
|
||||||
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
||||||
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue