ExternalProject: Fix git.cmd version detection
When GIT_EXECUTABLE points at ".../Git/cmd/git.cmd" in an msysGit installation we previously failed to detect the version number in a subtle case. The "git.cmd" assumes 'chcp' is in PATH. It is typically available at "C:\Windows\System32\chcp.com". On 64-bit Windows the File System Redirector maps this location to "C:\Windows\SysWOW64\chcp.com" for 32-bit processes. However, some Windows installations fail to provide chcp.com at this path. Whenever git.cmd runs in a 32-bit command shell, as it does under a 32-bit CMake binary, it reports 'chcp' is not recognized as an internal or external command, operable program or batch file. on stderr. Capture stderr separately so it does not affect parsing of the version number. See also msysGit issue 358: http://code.google.com/p/msysgit/issues/detail?id=358 Note that FindGit prefers "git.cmd" over "git.exe" because it sets up the proper HOME environment variable necessary for Git ssh connections to work the same as they do from the Git bash prompt.
This commit is contained in:
parent
0020fc4517
commit
8cb8ccc571
|
@ -954,6 +954,7 @@ function(_ep_get_git_version git_EXECUTABLE git_version_var)
|
|||
execute_process(
|
||||
COMMAND "${git_EXECUTABLE}" --version
|
||||
OUTPUT_VARIABLE ov
|
||||
ERROR_VARIABLE ev
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}")
|
||||
|
|
Loading…
Reference in New Issue