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

Method AddCustomCommandToTarget

Source/cmMakefile.cxx:1140–1172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1138}
1139
1140cmTarget* cmMakefile::AddCustomCommandToTarget(
1141 std::string const& target, cmCustomCommandType type,
1142 std::unique_ptr<cmCustomCommand> cc)
1143{
1144 auto const& byproducts = cc->GetByproducts();
1145 auto const& commandLines = cc->GetCommandLines();
1146
1147 cmTarget* t = this->GetCustomCommandTarget(
1148 target, cmObjectLibraryCommands::Reject, this->Backtrace);
1149
1150 // Validate custom commands.
1151 if (!t || !this->ValidateCustomCommand(commandLines)) {
1152 return t;
1153 }
1154
1155 // Always create the byproduct sources and mark them generated.
1156 this->CreateGeneratedOutputs(byproducts);
1157
1158 cc->RecordPolicyValues(this->GetStateSnapshot());
1159
1160 // Dispatch command creation to allow generator expressions in outputs.
1161 this->AddGeneratorAction(
1162 std::move(cc),
1163 [this, t, type](cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
1164 std::unique_ptr<cmCustomCommand> tcc) {
1165 BacktraceGuard guard(this->Backtrace, lfbt);
1166 tcc->SetBacktrace(lfbt);
1167 detail::AddCustomCommandToTarget(lg, cmCommandOrigin::Project, t, type,
1168 std::move(tcc));
1169 });
1170
1171 return t;
1172}
1173
1174void cmMakefile::AddCustomCommandToOutput(
1175 std::unique_ptr<cmCustomCommand> cc, CommandSourceCallback const& callback,

Callers 3

AddExtraTargetsMethod · 0.45
AddCheckTargetMethod · 0.45

Calls 9

ValidateCustomCommandMethod · 0.95
GetStateSnapshotMethod · 0.95
AddGeneratorActionMethod · 0.95
moveFunction · 0.85
AddCustomCommandToTargetFunction · 0.85
RecordPolicyValuesMethod · 0.80
SetBacktraceMethod · 0.45

Tested by

no test coverage detected