| 5241 | } |
| 5242 | |
| 5243 | cmSourceFile* cmLocalGenerator::GetSourceFileWithOutput( |
| 5244 | std::string const& name, cmSourceOutputKind kind) const |
| 5245 | { |
| 5246 | // If the queried path is not absolute we use the backward compatible |
| 5247 | // linear-time search for an output with a matching suffix. |
| 5248 | if (!cmSystemTools::FileIsFullPath(name)) { |
| 5249 | bool byproduct = false; |
| 5250 | return this->LinearGetSourceFileWithOutput(name, kind, byproduct); |
| 5251 | } |
| 5252 | // Otherwise we use an efficient lookup map. |
| 5253 | auto o = this->OutputToSource.find(name); |
| 5254 | if (o != this->OutputToSource.end() && |
| 5255 | (!o->second.Sources.SourceIsByproduct || |
| 5256 | kind == cmSourceOutputKind::OutputOrByproduct)) { |
| 5257 | // Source file could also be null pointer for example if we found the |
| 5258 | // byproduct of a utility target, a PRE_BUILD, PRE_LINK, or POST_BUILD |
| 5259 | // command of a target, or a not yet created custom command. |
| 5260 | return o->second.Sources.Source; |
| 5261 | } |
| 5262 | return nullptr; |
| 5263 | } |
| 5264 | |
| 5265 | std::string cmLocalGenerator::CreateUtilityOutput( |
| 5266 | std::string const& targetName, std::vector<std::string> const&, |
no test coverage detected