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

Method GenerateMainFile

Source/cmExportBuildSbomGenerator.cxx:25–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25bool cmExportBuildSbomGenerator::GenerateMainFile(std::ostream& os)
26{
27 if (!this->CollectExports([&](cmGeneratorTarget const*) {})) {
28 return false;
29 }
30
31 cmSbomDocument doc;
32 doc.Graph.reserve(256);
33
34 cmSpdxCreationInfo const* ci =
35 insert_back(doc.Graph, this->GenerateCreationInfo());
36 cmSpdxDocument* project = insert_back(doc.Graph, this->GenerateSbom(ci));
37 std::vector<TargetProperties> targets;
38
39 for (auto const& exp : this->Exports) {
40 cmGeneratorTarget const* target = exp.Target;
41
42 ImportPropertyMap properties;
43 this->PopulateInterfaceProperties(target, properties);
44 this->PopulateInterfaceLinkLibrariesProperty(
45 target, cmGeneratorExpression::BuildInterface, properties);
46 this->PopulateLinkLibrariesProperty(
47 target, cmGeneratorExpression::BuildInterface, properties);
48
49 targets.push_back(
50 TargetProperties{ insert_back(project->RootElements,
51 this->GenerateImportTarget(ci, target)),
52 target, std::move(properties) });
53 }
54
55 for (auto const& target : targets) {
56 this->GenerateProperties(doc, project, ci, target, targets);
57 }
58
59 this->WriteSbom(doc, os);
60 return true;
61}
62
63void cmExportBuildSbomGenerator::HandleMissingTarget(
64 std::string& /* link_libs */, cmGeneratorTarget const* /* depender */,

Callers 4

GenerateImportFileMethod · 0.45
GenerateImportFileMethod · 0.45
GenerateImportFileMethod · 0.45
GenerateImportFileMethod · 0.45

Calls 13

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

Tested by

no test coverage detected