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

Method GetOutputInfo

Source/cmGeneratorTarget.cxx:4513–4569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4511}
4512
4513cmGeneratorTarget::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

Callers 3

GetDirectoryMethod · 0.95
GetPDBDirectoryMethod · 0.95
DumpArtifactsMethod · 0.80

Calls 15

IsImportedMethod · 0.95
IsSyntheticMethod · 0.95
GetTypeMethod · 0.95
ComputeOutputDirMethod · 0.95
ComputePDBOutputDirMethod · 0.95
GetBacktraceMethod · 0.95
cmStrCatFunction · 0.70
GetNameMethod · 0.45
IssueMessageMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected