| 56 | } |
| 57 | |
| 58 | bool 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 | |
| 102 | void cmExportInstallSbomGenerator::GenerateImportTargetsConfig( |
| 103 | std::ostream& os, std::string const& config, std::string const& suffix) |
nothing calls this directly
no test coverage detected