From 8f0e1f2111c046aaa240a54c211404747c911698 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Sat, 20 Aug 2022 11:34:19 +0200 Subject: cmMakefile: add RaiseScope for list of variables --- Source/cmMakefile.cxx | 12 ++++++++++++ Source/cmMakefile.h | 1 + 2 files changed, 13 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b228e2b..51a4b3b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4188,6 +4188,18 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef) #endif } +void cmMakefile::RaiseScope(const std::vector& variables) +{ + for (auto const& varName : variables) { + if (this->IsNormalDefinitionSet(varName)) { + this->RaiseScope(varName, this->GetDefinition(varName)); + } else { + // unset variable in parent scope + this->RaiseScope(varName, nullptr); + } + } +} + cmTarget* cmMakefile::AddImportedTarget(const std::string& name, cmStateEnums::TargetType type, bool global) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 10432a8..1763177 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -880,6 +880,7 @@ public: { this->RaiseScope(var, value.GetCStr()); } + void RaiseScope(const std::vector& variables); // push and pop loop scopes void PushLoopBlockBarrier(); -- cgit v0.12