| 4511 | } |
| 4512 | |
| 4513 | cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo( |
| 4514 | std::string const& config) const |
| 4515 | { |
| 4516 | // There is no output information for imported targets. |
| 4517 | if (this->IsImported()) { |
| 4518 | return nullptr; |
| 4519 | } |
| 4520 | |
| 4521 | // Synthetic targets don't have output. |
| 4522 | if (this->IsSynthetic()) { |
| 4523 | return nullptr; |
| 4524 | } |
| 4525 | |
| 4526 | // Only libraries and executables have well-defined output files. |
| 4527 | if (!this->HaveWellDefinedOutputFiles()) { |
| 4528 | std::string msg = cmStrCat("cmGeneratorTarget::GetOutputInfo called for ", |
| 4529 | this->GetName(), " which has type ", |
| 4530 | cmState::GetTargetTypeName(this->GetType())); |
| 4531 | this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); |
| 4532 | return nullptr; |
| 4533 | } |
| 4534 | |
| 4535 | // Lookup/compute/cache the output information for this configuration. |
| 4536 | std::string config_upper; |
| 4537 | if (!config.empty()) { |
| 4538 | config_upper = cmSystemTools::UpperCase(config); |
| 4539 | } |
| 4540 | auto i = this->OutputInfoMap.find(config_upper); |
| 4541 | if (i == this->OutputInfoMap.end()) { |
| 4542 | // Add empty info in map to detect potential recursion. |
| 4543 | OutputInfo info; |
| 4544 | OutputInfoMapType::value_type entry(config_upper, info); |
| 4545 | i = this->OutputInfoMap.insert(entry).first; |
| 4546 | |
| 4547 | // Compute output directories. |
| 4548 | this->ComputeOutputDir(config, cmStateEnums::RuntimeBinaryArtifact, |
| 4549 | info.OutDir); |
| 4550 | this->ComputeOutputDir(config, cmStateEnums::ImportLibraryArtifact, |
| 4551 | info.ImpDir); |
| 4552 | if (!this->ComputePDBOutputDir("PDB", config, info.PdbDir)) { |
| 4553 | info.PdbDir = info.OutDir; |
| 4554 | } |
| 4555 | |
| 4556 | // Now update the previously-prepared map entry. |
| 4557 | i->second = info; |
| 4558 | } else if (i->second.empty()) { |
| 4559 | // An empty map entry indicates we have been called recursively |
| 4560 | // from the above block. |
| 4561 | this->LocalGenerator->GetCMakeInstance()->IssueMessage( |
| 4562 | MessageType::FATAL_ERROR, |
| 4563 | cmStrCat("Target '", this->GetName(), |
| 4564 | "' OUTPUT_DIRECTORY depends on itself."), |
| 4565 | this->GetBacktrace()); |
| 4566 | return nullptr; |
| 4567 | } |
| 4568 | return &i->second; |
| 4569 | } |
| 4570 |
no test coverage detected