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

Method AddUtilityCommand

Source/cmMakefile.cxx:1233–1265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1231}
1232
1233cmTarget* cmMakefile::AddUtilityCommand(std::string const& utilityName,
1234 bool excludeFromAll,
1235 std::unique_ptr<cmCustomCommand> cc)
1236{
1237 auto const& depends = cc->GetDepends();
1238 auto const& byproducts = cc->GetByproducts();
1239 auto const& commandLines = cc->GetCommandLines();
1240 cmTarget* target = this->AddNewUtilityTarget(utilityName, excludeFromAll);
1241
1242 // Validate custom commands.
1243 if ((commandLines.empty() && depends.empty()) ||
1244 !this->ValidateCustomCommand(commandLines)) {
1245 return target;
1246 }
1247
1248 // Always create the byproduct sources and mark them generated.
1249 this->CreateGeneratedOutputs(byproducts);
1250
1251 cc->RecordPolicyValues(this->GetStateSnapshot());
1252
1253 // Dispatch command creation to allow generator expressions in outputs.
1254 this->AddGeneratorAction(
1255 std::move(cc),
1256 [this, target](cmLocalGenerator& lg, cmListFileBacktrace const& lfbt,
1257 std::unique_ptr<cmCustomCommand> tcc) {
1258 BacktraceGuard guard(this->Backtrace, lfbt);
1259 tcc->SetBacktrace(lfbt);
1260 detail::AddUtilityCommand(lg, cmCommandOrigin::Project, target,
1261 std::move(tcc));
1262 });
1263
1264 return target;
1265}
1266
1267static void s_AddDefineFlag(std::string const& flag, std::string& dflags)
1268{

Callers 9

AddExtraTargetsMethod · 0.45
AddCheckTargetMethod · 0.45
AddAllTargetMethod · 0.45
InitAutogenTargetMethod · 0.45
InitRccTargetsMethod · 0.45
AddCheckTargetMethod · 0.45
AddExtraIDETargetsMethod · 0.45
cmAddCustomTargetCommandFunction · 0.45

Calls 11

AddNewUtilityTargetMethod · 0.95
ValidateCustomCommandMethod · 0.95
GetStateSnapshotMethod · 0.95
AddGeneratorActionMethod · 0.95
moveFunction · 0.85
AddUtilityCommandFunction · 0.85
GetDependsMethod · 0.80
RecordPolicyValuesMethod · 0.80
emptyMethod · 0.45
SetBacktraceMethod · 0.45

Tested by

no test coverage detected