diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2015-02-28 13:22:41 (GMT) |
---|---|---|
committer | Nils Gladitz <nilsgladitz@gmail.com> | 2015-02-28 13:22:41 (GMT) |
commit | cfb22354b8bff1f7eddc117616a80774d456f467 (patch) | |
tree | 1b8743a62241c405e90ad63f5bf815a800e2a2c0 /Modules/FindHg.cmake | |
parent | ae09fce8319112f8a401a843d4297e7c157a112a (diff) | |
download | CMake-cfb22354b8bff1f7eddc117616a80774d456f467.zip CMake-cfb22354b8bff1f7eddc117616a80774d456f467.tar.gz CMake-cfb22354b8bff1f7eddc117616a80774d456f467.tar.bz2 |
FindHg: Run hg with C locale when querying its version.
LANGUAGE should be ignored when LC_ALL=C.
It seems this isn't the case with hg so set both.
Diffstat (limited to 'Modules/FindHg.cmake')
-rw-r--r-- | Modules/FindHg.cmake | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake index 34d763e..bdbb79b 100644 --- a/Modules/FindHg.cmake +++ b/Modules/FindHg.cmake @@ -63,11 +63,21 @@ find_program(HG_EXECUTABLE mark_as_advanced(HG_EXECUTABLE) if(HG_EXECUTABLE) + set(_saved_lc_all "$ENV{LC_ALL}") + set(ENV{LC_ALL} "C") + + set(_saved_language "$ENV{LANGUAGE}") + set(ENV{LANGUAGE}) + execute_process(COMMAND ${HG_EXECUTABLE} --version OUTPUT_VARIABLE hg_version ERROR_QUIET RESULT_VARIABLE hg_result OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(ENV{LC_ALL} ${_saved_lc_all}) + set(ENV{LANGUAGE} ${_saved_language}) + if(hg_result MATCHES "is not a valid Win32 application") set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND") endif() |