diff options
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; } |