summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-12-28 22:15:41 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-07-18 09:53:46 (GMT)
commita74dad3bd3e5e4bbf09764a0b6bdedfe842442a7 (patch)
tree4aff5150f21f38f36c0c4d99243949f5b11602e5 /Source/cmMakefile.cxx
parentd26e6cb1c2f352da12200727a887e940aac463a7 (diff)
downloadCMake-a74dad3bd3e5e4bbf09764a0b6bdedfe842442a7.zip
CMake-a74dad3bd3e5e4bbf09764a0b6bdedfe842442a7.tar.gz
CMake-a74dad3bd3e5e4bbf09764a0b6bdedfe842442a7.tar.bz2
cmMakefile: decouple FinalAction from cmCommand
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx25
1 files changed, 22 insertions, 3 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 501ea69..a350789 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -355,6 +355,20 @@ private:
cmMakefile* Makefile;
};
+class cmFinalPassAction
+{
+public:
+ cmFinalPassAction(std::unique_ptr<cmCommand> command)
+ : Command(std::move(command))
+ {
+ }
+
+ void operator()(cmMakefile&) { this->Command->FinalPass(); }
+
+private:
+ std::shared_ptr<cmCommand> Command;
+};
+
bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
cmExecutionStatus& status)
{
@@ -417,7 +431,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
}
} else if (pcmd->HasFinalPass()) {
// use the command
- this->FinalPassCommands.push_back(std::move(pcmd));
+ this->AddFinalAction(cmFinalPassAction(std::move(pcmd)));
}
}
} else {
@@ -768,6 +782,11 @@ struct file_not_persistent
};
}
+void cmMakefile::AddFinalAction(FinalAction action)
+{
+ this->FinalActions.push_back(std::move(action));
+}
+
void cmMakefile::FinalPass()
{
// do all the variable expansions here
@@ -775,8 +794,8 @@ void cmMakefile::FinalPass()
// give all the commands a chance to do something
// after the file has been parsed before generation
- for (auto& command : this->FinalPassCommands) {
- command->FinalPass();
+ for (FinalAction& action : this->FinalActions) {
+ action(*this);
}
// go through all configured files and see which ones still exist.