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.
This commit is contained in:
Nils Gladitz 2015-02-28 14:22:41 +01:00
parent ae09fce831
commit cfb22354b8
1 changed files with 10 additions and 0 deletions

View File

@ -63,11 +63,21 @@ find_program(HG_EXECUTABLE
mark_as_advanced(HG_EXECUTABLE) mark_as_advanced(HG_EXECUTABLE)
if(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 execute_process(COMMAND ${HG_EXECUTABLE} --version
OUTPUT_VARIABLE hg_version OUTPUT_VARIABLE hg_version
ERROR_QUIET ERROR_QUIET
RESULT_VARIABLE hg_result RESULT_VARIABLE hg_result
OUTPUT_STRIP_TRAILING_WHITESPACE) 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") if(hg_result MATCHES "is not a valid Win32 application")
set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND") set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND")
endif() endif()