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

Function AppendCustomCommandToOutput

Source/cmLocalGenerator.cxx:5104–5148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5102}
5103
5104void AppendCustomCommandToOutput(cmLocalGenerator& lg,
5105 cmListFileBacktrace const& lfbt,
5106 std::string const& output,
5107 std::vector<std::string> const& depends,
5108 cmImplicitDependsList const& implicit_depends,
5109 cmCustomCommandLines const& commandLines)
5110{
5111 // Lookup an existing command.
5112 cmSourceFile* sf = nullptr;
5113 if (cmGeneratorExpression::Find(output) == std::string::npos) {
5114 sf = lg.GetSourceFileWithOutput(output);
5115 } else {
5116 // This output path has a generator expression. Evaluate it to
5117 // find the output for any configurations.
5118 for (std::string const& out :
5119 lg.ExpandCustomCommandOutputGenex(output, lfbt)) {
5120 sf = lg.GetSourceFileWithOutput(out);
5121 if (sf) {
5122 break;
5123 }
5124 }
5125 }
5126
5127 if (sf) {
5128 if (cmCustomCommand* cc = sf->GetCustomCommand()) {
5129 cc->AppendCommands(commandLines);
5130 cc->AppendDepends(depends);
5131 if (cc->GetCodegen() && !implicit_depends.empty()) {
5132 lg.GetCMakeInstance()->IssueMessage(
5133 MessageType::FATAL_ERROR,
5134 "Cannot append IMPLICIT_DEPENDS to existing CODEGEN custom "
5135 "command.");
5136 }
5137 cc->AppendImplicitDepends(implicit_depends);
5138 return;
5139 }
5140 }
5141
5142 // No existing command found.
5143 lg.GetCMakeInstance()->IssueMessage(
5144 MessageType::FATAL_ERROR,
5145 cmStrCat("Attempt to APPEND to custom command with output\n ", output,
5146 "\nwhich is not already a custom command output."),
5147 lfbt);
5148}
5149
5150void AddUtilityCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
5151 cmTarget* target, std::unique_ptr<cmCustomCommand> cc)

Callers 1

Calls 11

GetCustomCommandMethod · 0.80
AppendCommandsMethod · 0.80
AppendDependsMethod · 0.80
GetCodegenMethod · 0.80
AppendImplicitDependsMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
IssueMessageMethod · 0.45
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…