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

Method GenerateTargetFileSets

Source/cmExportCMakeConfigGenerator.cxx:599–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599void cmExportCMakeConfigGenerator::GenerateTargetFileSets(
600 cmGeneratorTarget* gte, std::ostream& os, cmTargetExport const* te)
601{
602 auto interfaceFileSets = gte->Target->GetAllInterfaceFileSets();
603 if (!interfaceFileSets.empty()) {
604 std::string targetName = cmStrCat(this->Namespace, gte->GetExportName());
605 os << "if(NOT CMAKE_VERSION VERSION_LESS \"3.23.0\")\n"
606 " target_sources("
607 << targetName << '\n';
608
609 for (auto const& name : interfaceFileSets) {
610 auto* fileSet = gte->Target->GetFileSet(name);
611 if (!fileSet) {
612 gte->Makefile->IssueMessage(
613 MessageType::FATAL_ERROR,
614 cmStrCat("File set \"", name,
615 "\" is listed in interface file sets of ", gte->GetName(),
616 " but has not been created"));
617 return;
618 }
619
620 os << " INTERFACE"
621 << "\n FILE_SET " << cmOutputConverter::EscapeForCMake(name)
622 << "\n TYPE "
623 << cmOutputConverter::EscapeForCMake(fileSet->GetType())
624 << "\n BASE_DIRS "
625 << this->GetFileSetDirectories(gte, fileSet, te) << "\n FILES "
626 << this->GetFileSetFiles(gte, fileSet, te) << '\n';
627 }
628
629 os << " )\nelse()\n set_property(TARGET " << targetName
630 << "\n APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES";
631 for (auto const& name : interfaceFileSets) {
632 auto* fileSet = gte->Target->GetFileSet(name);
633 if (!fileSet) {
634 gte->Makefile->IssueMessage(
635 MessageType::FATAL_ERROR,
636 cmStrCat("File set \"", name,
637 "\" is listed in interface file sets of ", gte->GetName(),
638 " but has not been created"));
639 return;
640 }
641
642 if (fileSet->GetType() == "HEADERS"_s) {
643 os << "\n " << this->GetFileSetDirectories(gte, fileSet, te);
644 }
645 }
646 os << "\n )\nendif()\n\n";
647 }
648}
649
650std::string cmExportCMakeConfigGenerator::GetCxxModuleFile(
651 std::string const& name) const

Callers 2

GenerateMainFileMethod · 0.80
GenerateMainFileMethod · 0.80

Calls 10

GetExportNameMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
GetFileSetMethod · 0.45
IssueMessageMethod · 0.45
GetNameMethod · 0.45
GetTypeMethod · 0.45
GetFileSetDirectoriesMethod · 0.45
GetFileSetFilesMethod · 0.45

Tested by

no test coverage detected