|
|
@@ -1180,72 +1180,6 @@ void cmMakefile::AddCustomCommandToOutput(
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-void cmMakefile::AddCustomCommandOldStyle(
|
|
|
- const std::string& target, const std::vector<std::string>& outputs,
|
|
|
- const std::vector<std::string>& depends, const std::string& source,
|
|
|
- const cmCustomCommandLines& commandLines, const char* comment)
|
|
|
-{
|
|
|
- auto cc = cm::make_unique<cmCustomCommand>();
|
|
|
- cc->SetDepends(depends);
|
|
|
- cc->SetCommandLines(commandLines);
|
|
|
- cc->SetComment(comment);
|
|
|
-
|
|
|
- // Translate the old-style signature to one of the new-style
|
|
|
- // signatures.
|
|
|
- if (source == target) {
|
|
|
- // In the old-style signature if the source and target were the
|
|
|
- // same then it added a post-build rule to the target. Preserve
|
|
|
- // this behavior.
|
|
|
- this->AddCustomCommandToTarget(target, cmCustomCommandType::POST_BUILD,
|
|
|
- std::move(cc));
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- auto ti = this->Targets.find(target);
|
|
|
- cmTarget* t = ti != this->Targets.end() ? &ti->second : nullptr;
|
|
|
-
|
|
|
- auto addRuleFileToTarget = [=](cmSourceFile* sf) {
|
|
|
- // If the rule was added to the source (and not a .rule file),
|
|
|
- // then add the source to the target to make sure the rule is
|
|
|
- // included.
|
|
|
- if (!sf->GetPropertyAsBool("__CMAKE_RULE")) {
|
|
|
- if (t) {
|
|
|
- t->AddSource(sf->ResolveFullPath());
|
|
|
- } else {
|
|
|
- cmSystemTools::Error("Attempt to add a custom rule to a target "
|
|
|
- "that does not exist yet for target " +
|
|
|
- target);
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- // Each output must get its own copy of this rule.
|
|
|
- cmsys::RegularExpression sourceFiles(
|
|
|
- "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|ixx|cppm|ccm|cxxm|c\\+\\+m|cu|m|mm|"
|
|
|
- "rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|"
|
|
|
- "hm|hpp|hxx|in|txx|inl)$");
|
|
|
-
|
|
|
- // Choose whether to use a main dependency.
|
|
|
- if (sourceFiles.find(source)) {
|
|
|
- // The source looks like a real file. Use it as the main dependency.
|
|
|
- for (std::string const& output : outputs) {
|
|
|
- auto cc1 = cm::make_unique<cmCustomCommand>(*cc);
|
|
|
- cc1->SetOutputs(output);
|
|
|
- cc1->SetMainDependency(source);
|
|
|
- this->AddCustomCommandToOutput(std::move(cc1), addRuleFileToTarget);
|
|
|
- }
|
|
|
- } else {
|
|
|
- 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(std::move(cc1), addRuleFileToTarget);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
void cmMakefile::AppendCustomCommandToOutput(
|
|
|
const std::string& output, const std::vector<std::string>& depends,
|
|
|
const cmImplicitDependsList& implicit_depends,
|