mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-26 10:48:38 -06:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user