diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2021-12-12 06:01:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-12-14 15:48:43 (GMT) |
commit | 780341f360773d7b3b766b835bd539f46397e0a6 (patch) | |
tree | 767cdbaa73a9b9c7c38a31ab962034f1386d918f /Source/cmMakefile.cxx | |
parent | a6fa3fa136c291c36aefbc79b62995a63bf9107b (diff) | |
download | CMake-780341f360773d7b3b766b835bd539f46397e0a6.zip CMake-780341f360773d7b3b766b835bd539f46397e0a6.tar.gz CMake-780341f360773d7b3b766b835bd539f46397e0a6.tar.bz2 |
cmCustomCommand: Track main dependency explicitly
Store the main dependency as the first entry in the dependency list plus
a boolean member indicating its existence. Note that this slightly
changes existing behavior: the main dependency was previously the last
entry of the dependency list.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 950fa7b..cc687b1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1087,8 +1087,8 @@ cmTarget* cmMakefile::AddCustomCommandToTarget( } void cmMakefile::AddCustomCommandToOutput( - const std::string& main_dependency, std::unique_ptr<cmCustomCommand> cc, - const CommandSourceCallback& callback, bool replace) + std::unique_ptr<cmCustomCommand> cc, const CommandSourceCallback& callback, + bool replace) { const auto& outputs = cc->GetOutputs(); const auto& byproducts = cc->GetByproducts(); @@ -1119,8 +1119,7 @@ void cmMakefile::AddCustomCommandToOutput( BacktraceGuard guard(this->Backtrace, lfbt); tcc->SetBacktrace(lfbt); cmSourceFile* sf = detail::AddCustomCommandToOutput( - lg, cmCommandOrigin::Project, main_dependency, std::move(tcc), - replace); + lg, cmCommandOrigin::Project, std::move(tcc), replace); if (callback && sf) { callback(sf); } @@ -1178,19 +1177,17 @@ void cmMakefile::AddCustomCommandOldStyle( for (std::string const& output : outputs) { auto cc1 = cm::make_unique<cmCustomCommand>(*cc); cc1->SetOutputs(output); - this->AddCustomCommandToOutput(source, std::move(cc1), - addRuleFileToTarget); + cc1->SetMainDependency(source); + this->AddCustomCommandToOutput(std::move(cc1), addRuleFileToTarget); } } else { - std::string no_main_dependency; cc->AppendDepends({ source }); // The source may not be a real file. Do not use a main dependency. for (std::string const& output : outputs) { auto cc1 = cm::make_unique<cmCustomCommand>(*cc); cc1->SetOutputs(output); - this->AddCustomCommandToOutput(no_main_dependency, std::move(cc1), - addRuleFileToTarget); + this->AddCustomCommandToOutput(std::move(cc1), addRuleFileToTarget); } } } |