| 1138 | } |
| 1139 | |
| 1140 | cmTarget* 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 | |
| 1174 | void cmMakefile::AddCustomCommandToOutput( |
| 1175 | std::unique_ptr<cmCustomCommand> cc, CommandSourceCallback const& callback, |
no test coverage detected