| 23 | } |
| 24 | |
| 25 | bool 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 | |
| 63 | void cmExportBuildSbomGenerator::HandleMissingTarget( |
| 64 | std::string& /* link_libs */, cmGeneratorTarget const* /* depender */, |
no test coverage detected