diff options
author | Brad King <brad.king@kitware.com> | 2023-04-26 13:34:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-04-26 14:03:14 (GMT) |
commit | 1df24df01f0053d07ac2083c4ea8fa915cbb5e65 (patch) | |
tree | b5ecbf71b2f825ba73b9004dd617ba34e719a9f7 /Source | |
parent | 827d5b75d47126205faba26cabc8856c6d9c3362 (diff) | |
download | CMake-1df24df01f0053d07ac2083c4ea8fa915cbb5e65.zip CMake-1df24df01f0053d07ac2083c4ea8fa915cbb5e65.tar.gz CMake-1df24df01f0053d07ac2083c4ea8fa915cbb5e65.tar.bz2 |
presets: Fix encoding of env/penv macro expansion on Windows
Look up environment variables using a wide-character API on Windows,
and convert their value to our internal UTF-8 encoding.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCMakePresetsGraph.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index 13e8bad..f9b263a 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -4,7 +4,6 @@ #include <algorithm> #include <cassert> -#include <cstdlib> #include <functional> #include <iostream> #include <iterator> @@ -448,9 +447,9 @@ bool ExpandMacros(cmCMakePresetsGraph& graph, const T& preset, if (macroName.empty()) { return ExpandMacroResult::Error; } - const char* value = std::getenv(macroName.c_str()); - if (value) { - result += value; + if (cm::optional<std::string> value = + cmSystemTools::GetEnvVar(macroName)) { + result += *value; } return ExpandMacroResult::Ok; } |