MCPcopy Create free account
hub / github.com/Kitware/CMake / SetImportLinkInterface

Method SetImportLinkInterface

Source/cmExportCMakeConfigGenerator.cxx:103–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void 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
151void cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode(std::ostream& os)
152{

Callers 2

Calls 9

GetLinkInterfaceMethod · 0.80
strMethod · 0.80
GetPropertyMethod · 0.45
GetLocalGeneratorMethod · 0.45
GetNameMethod · 0.45
IssueMessageMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected