| 101 | } |
| 102 | |
| 103 | void cmExportCMakeConfigGenerator::SetImportLinkInterface( |
| 104 | std::string const& config, std::string const& suffix, |
| 105 | cmGeneratorExpression::PreprocessContext preprocessRule, |
| 106 | cmGeneratorTarget const* target, ImportPropertyMap& properties) |
| 107 | { |
| 108 | // Add the transitive link dependencies for this configuration. |
| 109 | cmLinkInterface const* iface = target->GetLinkInterface(config, target); |
| 110 | if (!iface) { |
| 111 | return; |
| 112 | } |
| 113 | |
| 114 | cmValue propContent; |
| 115 | |
| 116 | if (cmValue prop_suffixed = |
| 117 | target->GetProperty("LINK_INTERFACE_LIBRARIES" + suffix)) { |
| 118 | propContent = prop_suffixed; |
| 119 | } else if (cmValue prop = target->GetProperty("LINK_INTERFACE_LIBRARIES")) { |
| 120 | propContent = prop; |
| 121 | } else { |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | if (!this->ExportOld) { |
| 126 | cmLocalGenerator* lg = target->GetLocalGenerator(); |
| 127 | std::ostringstream e; |
| 128 | e << "Target \"" << target->GetName() |
| 129 | << "\" has policy CMP0022 enabled, " |
| 130 | "but also has old-style LINK_INTERFACE_LIBRARIES properties " |
| 131 | "populated, but it was exported without the " |
| 132 | "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties"; |
| 133 | lg->IssueMessage(MessageType::FATAL_ERROR, e.str()); |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | if (propContent->empty()) { |
| 138 | properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix].clear(); |
| 139 | return; |
| 140 | } |
| 141 | |
| 142 | std::string prepro = |
| 143 | cmGeneratorExpression::Preprocess(*propContent, preprocessRule); |
| 144 | if (!prepro.empty()) { |
| 145 | this->ResolveTargetsInGeneratorExpressions(prepro, target, |
| 146 | ReplaceFreeTargets); |
| 147 | properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | void cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode(std::ostream& os) |
| 152 | { |
no test coverage detected