diff options
Diffstat (limited to 'Source/cmMakefile.cxx')
| -rw-r--r-- | Source/cmMakefile.cxx | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 93fb8b4..936b282 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -302,6 +302,11 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const return this->Backtrace; } +cmFindPackageStack cmMakefile::GetFindPackageStack() const +{ + return this->FindPackageStack; +} + void cmMakefile::PrintCommandTrace(cmListFileFunction const& lff, cmListFileBacktrace const& bt, CommandMissingFromStack missing) const @@ -1215,8 +1220,8 @@ cmTarget* cmMakefile::AddCustomCommandToTarget( // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( std::move(cc), - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, - std::unique_ptr<cmCustomCommand> tcc) { + [this, t, type](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, + std::unique_ptr<cmCustomCommand> tcc) { BacktraceGuard guard(this->Backtrace, lfbt); tcc->SetBacktrace(lfbt); detail::AddCustomCommandToTarget(lg, cmCommandOrigin::Project, t, type, @@ -1254,8 +1259,9 @@ void cmMakefile::AddCustomCommandToOutput( // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( std::move(cc), - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, - std::unique_ptr<cmCustomCommand> tcc) { + [this, replace, callback](cmLocalGenerator& lg, + const cmListFileBacktrace& lfbt, + std::unique_ptr<cmCustomCommand> tcc) { BacktraceGuard guard(this->Backtrace, lfbt); tcc->SetBacktrace(lfbt); cmSourceFile* sf = detail::AddCustomCommandToOutput( @@ -1341,7 +1347,8 @@ void cmMakefile::AppendCustomCommandToOutput( if (this->ValidateCustomCommand(commandLines)) { // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) { + [this, output, depends, implicit_depends, + commandLines](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) { BacktraceGuard guard(this->Backtrace, lfbt); detail::AppendCustomCommandToOutput(lg, lfbt, output, depends, implicit_depends, commandLines); @@ -1372,8 +1379,8 @@ cmTarget* cmMakefile::AddUtilityCommand(const std::string& utilityName, // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( std::move(cc), - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, - std::unique_ptr<cmCustomCommand> tcc) { + [this, target](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, + std::unique_ptr<cmCustomCommand> tcc) { BacktraceGuard guard(this->Backtrace, lfbt); tcc->SetBacktrace(lfbt); detail::AddUtilityCommand(lg, cmCommandOrigin::Project, target, @@ -4633,12 +4640,13 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, } // Deprecate old policies. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0120 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0126 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083 || - id == cmPolicies::CMP0091 || id == cmPolicies::CMP0104)) && + id == cmPolicies::CMP0091 || id == cmPolicies::CMP0104 || + id == cmPolicies::CMP0123 || id == cmPolicies::CMP0126)) && (!this->IsSet("CMAKE_WARN_DEPRECATED") || this->IsOn("CMAKE_WARN_DEPRECATED"))) { this->IssueMessage(MessageType::DEPRECATION_WARNING, @@ -4771,6 +4779,36 @@ cmMakefile::MacroPushPop::~MacroPushPop() this->Makefile->PopMacroScope(this->ReportError); } +cmMakefile::FindPackageStackRAII::FindPackageStackRAII(cmMakefile* mf, + std::string const& name) + : Makefile(mf) +{ + this->Makefile->FindPackageStack = + this->Makefile->FindPackageStack.Push(cmFindPackageCall{ + name, + this->Makefile->FindPackageStackNextIndex, + }); + this->Makefile->FindPackageStackNextIndex++; +} + +cmMakefile::FindPackageStackRAII::~FindPackageStackRAII() +{ + this->Makefile->FindPackageStackNextIndex = + this->Makefile->FindPackageStack.Top().Index + 1; + this->Makefile->FindPackageStack = this->Makefile->FindPackageStack.Pop(); + + if (!this->Makefile->FindPackageStack.Empty()) { + auto top = this->Makefile->FindPackageStack.Top(); + this->Makefile->FindPackageStack = this->Makefile->FindPackageStack.Pop(); + + top.Index = this->Makefile->FindPackageStackNextIndex; + this->Makefile->FindPackageStackNextIndex++; + + this->Makefile->FindPackageStack = + this->Makefile->FindPackageStack.Push(top); + } +} + cmMakefile::DebugFindPkgRAII::DebugFindPkgRAII(cmMakefile* mf, std::string const& pkg) : Makefile(mf) |
