| 38 | } |
| 39 | |
| 40 | bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os) |
| 41 | { |
| 42 | { |
| 43 | std::string expectedTargets; |
| 44 | std::string sep; |
| 45 | bool generatedInterfaceRequired = false; |
| 46 | auto visitor = [&](cmGeneratorTarget const* te) { |
| 47 | expectedTargets += sep + this->Namespace + te->GetExportName(); |
| 48 | sep = " "; |
| 49 | |
| 50 | generatedInterfaceRequired |= |
| 51 | this->GetExportTargetType(te) == cmStateEnums::INTERFACE_LIBRARY; |
| 52 | }; |
| 53 | |
| 54 | if (!this->CollectExports(visitor)) { |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | if (generatedInterfaceRequired) { |
| 59 | this->SetRequiredCMakeVersion(3, 0, 0); |
| 60 | } |
| 61 | this->GenerateExpectedTargetsCode(os, expectedTargets); |
| 62 | } |
| 63 | |
| 64 | // Create all the imported targets. |
| 65 | for (auto const& exp : this->Exports) { |
| 66 | cmGeneratorTarget* gte = exp.Target; |
| 67 | this->GenerateImportTargetCode(os, gte, this->GetExportTargetType(gte)); |
| 68 | |
| 69 | gte->Target->AppendBuildInterfaceIncludes(); |
| 70 | |
| 71 | ImportPropertyMap properties; |
| 72 | if (!this->PopulateInterfaceProperties(gte, properties)) { |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | this->PopulateInterfaceLinkLibrariesProperty( |
| 77 | gte, cmGeneratorExpression::BuildInterface, properties); |
| 78 | |
| 79 | this->GenerateInterfaceProperties(gte, os, properties); |
| 80 | |
| 81 | this->GenerateTargetFileSets(gte, os); |
| 82 | } |
| 83 | |
| 84 | std::string cxx_modules_name; |
| 85 | if (this->ExportSet) { |
| 86 | cxx_modules_name = this->ExportSet->GetName(); |
| 87 | } else { |
| 88 | cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_512); |
| 89 | constexpr std::size_t HASH_TRUNCATION = 12; |
| 90 | for (auto const& target : this->Targets) { |
| 91 | hasher.Append(target.Name); |
| 92 | } |
| 93 | cxx_modules_name = hasher.FinalizeHex().substr(0, HASH_TRUNCATION); |
| 94 | } |
| 95 | |
| 96 | this->GenerateCxxModuleInformation(cxx_modules_name, os); |
| 97 |
nothing calls this directly
no test coverage detected