| 47 | } |
| 48 | |
| 49 | bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os) |
| 50 | { |
| 51 | std::vector<cmTargetExport const*> allTargets; |
| 52 | { |
| 53 | std::string expectedTargets; |
| 54 | std::string sep; |
| 55 | auto visitor = [&](cmTargetExport const* te) { |
| 56 | allTargets.push_back(te); |
| 57 | expectedTargets += sep + this->Namespace + te->Target->GetExportName(); |
| 58 | sep = " "; |
| 59 | }; |
| 60 | |
| 61 | if (!this->CollectExports(visitor)) { |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | this->GenerateExpectedTargetsCode(os, expectedTargets); |
| 66 | } |
| 67 | |
| 68 | // Compute the relative import prefix for the file |
| 69 | this->GenerateImportPrefix(os); |
| 70 | |
| 71 | bool requiresConfigFiles = false; |
| 72 | // Create all the imported targets. |
| 73 | for (cmTargetExport const* te : allTargets) { |
| 74 | cmGeneratorTarget* gt = te->Target; |
| 75 | cmStateEnums::TargetType targetType = this->GetExportTargetType(te); |
| 76 | |
| 77 | requiresConfigFiles = |
| 78 | requiresConfigFiles || targetType != cmStateEnums::INTERFACE_LIBRARY; |
| 79 | |
| 80 | this->GenerateImportTargetCode(os, gt, targetType); |
| 81 | |
| 82 | ImportPropertyMap properties; |
| 83 | if (!this->PopulateInterfaceProperties(te, properties)) { |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | if (this->PopulateInterfaceLinkLibrariesProperty( |
| 88 | gt, cmGeneratorExpression::InstallInterface, properties) && |
| 89 | !this->ExportOld) { |
| 90 | this->SetRequiredCMakeVersion(2, 8, 12); |
| 91 | } |
| 92 | if (targetType == cmStateEnums::INTERFACE_LIBRARY) { |
| 93 | this->SetRequiredCMakeVersion(3, 0, 0); |
| 94 | } |
| 95 | if (gt->GetProperty("INTERFACE_SOURCES")) { |
| 96 | // We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1 |
| 97 | // can consume them. |
| 98 | this->SetRequiredCMakeVersion(3, 1, 0); |
| 99 | } |
| 100 | |
| 101 | this->GenerateInterfaceProperties(gt, os, properties); |
| 102 | |
| 103 | this->GenerateTargetFileSets(gt, os, te); |
| 104 | } |
| 105 | |
| 106 | this->LoadConfigFiles(os); |
nothing calls this directly
no test coverage detected