MCPcopy Create free account
hub / github.com/Kitware/CMake / AddCustomCommandToOutput

Method AddCustomCommandToOutput

Source/cmMakefile.cxx:1174–1213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1172}
1173
1174void cmMakefile::AddCustomCommandToOutput(
1175 std::unique_ptr<cmCustomCommand> cc, CommandSourceCallback const& callback,
1176 bool replace)
1177{
1178 auto const& outputs = cc->GetOutputs();
1179 auto const& byproducts = cc->GetByproducts();
1180 auto const& commandLines = cc->GetCommandLines();
1181
1182 // Make sure there is at least one output.
1183 if (outputs.empty()) {
1184 cmSystemTools::Error("Attempt to add a custom rule with no output!");
1185 return;
1186 }
1187
1188 // Validate custom commands.
1189 if (!this->ValidateCustomCommand(commandLines)) {
1190 return;
1191 }
1192
1193 // Always create the output sources and mark them generated.
1194 this->CreateGeneratedOutputs(outputs);
1195 this->CreateGeneratedOutputs(byproducts);
1196
1197 cc->RecordPolicyValues(this->GetStateSnapshot());
1198
1199 // Dispatch command creation to allow generator expressions in outputs.
1200 this->AddGeneratorAction(
1201 std::move(cc),
1202 [this, replace, callback](cmLocalGenerator& lg,
1203 cmListFileBacktrace const& lfbt,
1204 std::unique_ptr<cmCustomCommand> tcc) {
1205 BacktraceGuard guard(this->Backtrace, lfbt);
1206 tcc->SetBacktrace(lfbt);
1207 cmSourceFile* sf = detail::AddCustomCommandToOutput(
1208 lg, cmCommandOrigin::Project, std::move(tcc), replace);
1209 if (callback && sf) {
1210 callback(sf);
1211 }
1212 });
1213}
1214
1215void cmMakefile::AppendCustomCommandToOutput(
1216 std::string const& output, std::vector<std::string> const& depends,

Callers 10

cmQTWrapUICommandFunction · 0.45
cmFLTKWrapUICommandFunction · 0.45
AddCheckTargetMethod · 0.45
InitAutogenTargetMethod · 0.45
InitRccTargetsMethod · 0.45
AddCheckTargetMethod · 0.45
FixGlobalTargetsMethod · 0.45
CreateVCProjBuildRuleMethod · 0.45
cmQTWrapCPPCommandFunction · 0.45

Calls 10

ValidateCustomCommandMethod · 0.95
GetStateSnapshotMethod · 0.95
AddGeneratorActionMethod · 0.95
moveFunction · 0.85
AddCustomCommandToOutputFunction · 0.85
RecordPolicyValuesMethod · 0.80
ErrorClass · 0.70
emptyMethod · 0.45
SetBacktraceMethod · 0.45

Tested by

no test coverage detected