summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-01-10 19:38:22 (GMT)
committerBrad King <brad.king@kitware.com>2012-01-10 20:02:40 (GMT)
commit8cb8ccc5712da169518bb5be7c23bd7d20530818 (patch)
treef42c40e3b2ec6cbd76619c5bc4d904d991f03bcd /Modules/ExternalProject.cmake
parent0020fc45171c2d8b954492ea76c3b3940ebf53f3 (diff)
downloadCMake-8cb8ccc5712da169518bb5be7c23bd7d20530818.zip
CMake-8cb8ccc5712da169518bb5be7c23bd7d20530818.tar.gz
CMake-8cb8ccc5712da169518bb5be7c23bd7d20530818.tar.bz2
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.
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index a37771b..308dc70 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -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}")