summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2024-03-20 08:14:51 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2024-08-27 15:30:23 (GMT)
commitc48affe037ca3cbc78505188b9dd56f2aa5144dd (patch)
tree218cc475ce41d3b45670befacc500ca617ce49d9 /Source/cmMakefile.cxx
parentc66821b22bc65895bb6287d74d55cd9100de2362 (diff)
downloadCMake-c48affe037ca3cbc78505188b9dd56f2aa5144dd.zip
CMake-c48affe037ca3cbc78505188b9dd56f2aa5144dd.tar.gz
CMake-c48affe037ca3cbc78505188b9dd56f2aa5144dd.tar.bz2
cmMakefile: support "after generator target" generator actions
These actions may require additional information gathered during generation. Run them at the appropriate time.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2803279..8ffd855 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1055,8 +1055,13 @@ void cmMakefile::AddGeneratorAction(GeneratorAction&& action)
}
void cmMakefile::GeneratorAction::operator()(cmLocalGenerator& lg,
- const cmListFileBacktrace& lfbt)
+ const cmListFileBacktrace& lfbt,
+ GeneratorActionWhen when)
{
+ if (this->When != when) {
+ return;
+ }
+
if (cc) {
CCAction(lg, lfbt, std::move(cc));
} else {
@@ -1073,7 +1078,7 @@ void cmMakefile::DoGenerate(cmLocalGenerator& lg)
// give all the commands a chance to do something
// after the file has been parsed before generation
for (auto& action : this->GeneratorActions) {
- action.Value(lg, action.Backtrace);
+ action.Value(lg, action.Backtrace, GeneratorActionWhen::AfterConfigure);
}
this->GeneratorActionsInvoked = true;
@@ -1107,6 +1112,14 @@ void cmMakefile::Generate(cmLocalGenerator& lg)
}
}
+void cmMakefile::GenerateAfterGeneratorTargets(cmLocalGenerator& lg)
+{
+ for (auto& action : this->GeneratorActions) {
+ action.Value(lg, action.Backtrace,
+ GeneratorActionWhen::AfterGeneratorTargets);
+ }
+}
+
namespace {
// There are still too many implicit backtraces through cmMakefile. As a
// workaround we reset the backtrace temporarily.