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

Method GenerateMainFile

Source/cmExportInstallSbomGenerator.cxx:58–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58bool cmExportInstallSbomGenerator::GenerateMainFile(std::ostream& os)
59{
60 std::vector<cmTargetExport const*> allTargets;
61 {
62 auto visitor = [&](cmTargetExport const* te) { allTargets.push_back(te); };
63
64 if (!this->CollectExports(visitor)) {
65 return false;
66 }
67 }
68 cmSbomDocument doc;
69 doc.Graph.reserve(256);
70
71 cmSpdxCreationInfo const* ci =
72 insert_back(doc.Graph, this->GenerateCreationInfo());
73 cmSpdxDocument* project = insert_back(doc.Graph, this->GenerateSbom(ci));
74 std::vector<TargetProperties> targets;
75 targets.reserve(allTargets.size());
76
77 for (cmTargetExport const* te : allTargets) {
78 cmGeneratorTarget const* gt = te->Target;
79 ImportPropertyMap properties;
80 if (!this->PopulateInterfaceProperties(te, properties)) {
81 return false;
82 }
83 this->PopulateLinkLibrariesProperty(
84 gt, cmGeneratorExpression::InstallInterface, properties);
85 this->PopulateInterfaceLinkLibrariesProperty(
86 gt, cmGeneratorExpression::InstallInterface, properties);
87
88 targets.push_back(TargetProperties{
89 insert_back(project->RootElements,
90 this->GenerateImportTarget(ci, te->Target)),
91 te->Target, std::move(properties) });
92 }
93
94 for (auto const& target : targets) {
95 this->GenerateProperties(doc, project, ci, target, targets);
96 }
97
98 this->WriteSbom(doc, os);
99 return true;
100}
101
102void cmExportInstallSbomGenerator::GenerateImportTargetsConfig(
103 std::ostream& os, std::string const& config, std::string const& suffix)

Callers

nothing calls this directly

Calls 14

insert_backFunction · 0.85
moveFunction · 0.85
push_backMethod · 0.80
reserveMethod · 0.80
GenerateCreationInfoMethod · 0.80
GenerateSbomMethod · 0.80
GeneratePropertiesMethod · 0.80
CollectExportsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected