summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-12 13:56:07 (GMT)
committerBrad King <brad.king@kitware.com>2020-03-12 14:07:29 (GMT)
commitee3ec27465a4070591e5ce6c9ba72117788bf033 (patch)
treeebf549d2ce5ac9d81d8383f1d48951163112b092 /Modules/CMakeDetermineCompilerId.cmake
parentc7c6e103d1209f7e29cb2909cf342be75478f304 (diff)
downloadCMake-ee3ec27465a4070591e5ce6c9ba72117788bf033.zip
CMake-ee3ec27465a4070591e5ce6c9ba72117788bf033.tar.gz
CMake-ee3ec27465a4070591e5ce6c9ba72117788bf033.tar.bz2
CMakeDetermineCompilerId: Set locale to C for vendor output match
Apply the change from commit d751d2d2ed (CMakeDetermineCompilerABI: set locale to C for try_compile(), 2019-01-14, v3.14.0-rc1~108^2~1) to the `CMAKE_DETERMINE_COMPILER_ID_VENDOR` implementation too.
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index d125791..61d2fbe 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -868,6 +868,14 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags)
file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
endif()
+ # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
+ # and set them to "C" so we get the expected output to match.
+ set(_orig_lc_all $ENV{LC_ALL})
+ set(_orig_lc_messages $ENV{LC_MESSAGES})
+ set(_orig_lang $ENV{LANG})
+ set(ENV{LC_ALL} C)
+ set(ENV{LC_MESSAGES} C)
+ set(ENV{LANG} C)
foreach(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
@@ -902,6 +910,11 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags)
endif()
endif()
endforeach()
+
+ # Restore original LC_ALL, LC_MESSAGES, and LANG
+ set(ENV{LC_ALL} ${_orig_lc_all})
+ set(ENV{LC_MESSAGES} ${_orig_lc_messages})
+ set(ENV{LANG} ${_orig_lang})
endfunction()
function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)