MCPcopy Index your code
hub / github.com/Kitware/CMake / SetImportLocationProperty

Method SetImportLocationProperty

Source/cmExportInstallFileGenerator.cxx:142–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void cmExportInstallFileGenerator::SetImportLocationProperty(
143 std::string const& config, std::string const& suffix,
144 cmInstallTargetGenerator* itgen, ImportPropertyMap& properties,
145 std::set<std::string>& importedLocations)
146{
147 // Skip rules that do not match this configuration.
148 if (!(itgen && itgen->InstallsForConfig(config))) {
149 return;
150 }
151
152 // Get the target to be installed.
153 cmGeneratorTarget* target = itgen->GetTarget();
154
155 // Construct the installed location of the target.
156 std::string dest = itgen->GetDestination(config);
157 std::string value;
158 if (!cmSystemTools::FileIsFullPath(dest)) {
159 // The target is installed relative to the installation prefix.
160 value = std::string{ this->GetImportPrefixWithSlash() };
161 }
162 value += dest;
163 value += "/";
164
165 if (itgen->IsImportLibrary()) {
166 // Construct the property name.
167 std::string prop = cmStrCat("IMPORTED_IMPLIB", suffix);
168
169 // Append the installed file name.
170 value += cmInstallTargetGenerator::GetInstallFilename(
171 target, config, cmInstallTargetGenerator::NameImplibReal);
172
173 // Store the property.
174 properties[prop] = value;
175 importedLocations.insert(prop);
176 } else if (itgen->GetTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) {
177 // Construct the property name.
178 std::string prop = cmStrCat("IMPORTED_OBJECTS", suffix);
179
180 // Compute all the object files inside this target and setup
181 // IMPORTED_OBJECTS as a list of object files
182 std::vector<std::string> objects;
183 itgen->GetInstallObjectNames(config, objects);
184 for (std::string& obj : objects) {
185 obj = cmStrCat(value, obj);
186 }
187
188 // Store the property.
189 properties[prop] = cmList::to_string(objects);
190 importedLocations.insert(prop);
191 } else {
192 if (target->IsFrameworkOnApple() && target->HasImportLibrary(config)) {
193 // store as well IMPLIB value
194 auto importProp = cmStrCat("IMPORTED_IMPLIB", suffix);
195 auto importValue =
196 cmStrCat(value,
197 cmInstallTargetGenerator::GetInstallFilename(
198 target, config, cmInstallTargetGenerator::NameImplibReal));
199

Callers 1

Calls 14

to_stringFunction · 0.85
InstallsForConfigMethod · 0.80
IsImportLibraryMethod · 0.80
GetInstallObjectNamesMethod · 0.80
HasImportLibraryMethod · 0.80
cmStrCatFunction · 0.70
GetTargetMethod · 0.45
GetDestinationMethod · 0.45
insertMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected