From 1df24df01f0053d07ac2083c4ea8fa915cbb5e65 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 26 Apr 2023 09:34:25 -0400 Subject: 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. --- Source/cmCMakePresetsGraph.cxx | 7 +++---- 1 file 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 #include -#include #include #include #include @@ -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 value = + cmSystemTools::GetEnvVar(macroName)) { + result += *value; } return ExpandMacroResult::Ok; } -- cgit v0.12