| 5435 | } |
| 5436 | |
| 5437 | cmSourceFile* cmLocalGenerator::LinearGetSourceFileWithOutput( |
| 5438 | std::string const& name, cmSourceOutputKind kind, bool& byproduct) const |
| 5439 | { |
| 5440 | // Outputs take precedence over byproducts. |
| 5441 | byproduct = false; |
| 5442 | cmSourceFile* fallback = nullptr; |
| 5443 | |
| 5444 | // Look through all the source files that have custom commands and see if the |
| 5445 | // custom command has the passed source file as an output. |
| 5446 | for (auto const& src : this->Makefile->GetSourceFiles()) { |
| 5447 | // Does this source file have a custom command? |
| 5448 | if (src->GetCustomCommand()) { |
| 5449 | // Does the output of the custom command match the source file name? |
| 5450 | if (AnyOutputMatches(name, src->GetCustomCommand()->GetOutputs())) { |
| 5451 | // Return the first matching output. |
| 5452 | return src.get(); |
| 5453 | } |
| 5454 | if (kind == cmSourceOutputKind::OutputOrByproduct) { |
| 5455 | if (AnyOutputMatches(name, src->GetCustomCommand()->GetByproducts())) { |
| 5456 | // Do not return the source yet as there might be a matching output. |
| 5457 | fallback = src.get(); |
| 5458 | } |
| 5459 | } |
| 5460 | } |
| 5461 | } |
| 5462 | |
| 5463 | // Did we find a byproduct? |
| 5464 | byproduct = fallback != nullptr; |
| 5465 | return fallback; |
| 5466 | } |
no test coverage detected