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

Method GenerateImportPropertyCode

Source/cmExportCMakeConfigGenerator.cxx:358–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358void cmExportCMakeConfigGenerator::GenerateImportPropertyCode(
359 std::ostream& os, std::string const& config, std::string const& suffix,
360 cmGeneratorTarget const* target, ImportPropertyMap const& properties,
361 std::string const& importedXcFrameworkLocation)
362{
363 // Construct the imported target name.
364 std::string targetName = this->Namespace;
365
366 targetName += target->GetExportName();
367
368 // Set the import properties.
369 os << "# Import target \"" << targetName << "\" for configuration \""
370 << config
371 << "\"\n"
372 "set_property(TARGET "
373 << targetName << " APPEND PROPERTY IMPORTED_CONFIGURATIONS ";
374 if (!config.empty()) {
375 os << cmSystemTools::UpperCase(config);
376 } else {
377 os << "NOCONFIG";
378 }
379 os << ")\n"
380 "set_target_properties("
381 << targetName << " PROPERTIES\n";
382 std::string importedLocationProp = cmStrCat("IMPORTED_LOCATION", suffix);
383 for (auto const& property : properties) {
384 if (importedXcFrameworkLocation.empty() ||
385 property.first != importedLocationProp) {
386 os << " " << property.first << ' '
387 << cmExportFileGeneratorEscape(property.second) << '\n';
388 }
389 }
390 os << " )\n";
391 if (!importedXcFrameworkLocation.empty()) {
392 auto importedLocationIt = properties.find(importedLocationProp);
393 if (importedLocationIt != properties.end()) {
394 os << "if(NOT CMAKE_VERSION VERSION_LESS \"3.28\" AND IS_DIRECTORY "
395 << cmExportFileGeneratorEscape(importedXcFrameworkLocation)
396 << ")\n"
397 " set_property(TARGET "
398 << targetName << " PROPERTY " << importedLocationProp << ' '
399 << cmExportFileGeneratorEscape(importedXcFrameworkLocation)
400 << ")\nelse()\n set_property(TARGET " << targetName << " PROPERTY "
401 << importedLocationProp << ' '
402 << cmExportFileGeneratorEscape(importedLocationIt->second)
403 << ")\nendif()\n";
404 }
405 }
406 os << '\n';
407}
408
409void cmExportCMakeConfigGenerator::GenerateFindDependencyCalls(
410 std::ostream& os)

Callers 2

Calls 6

GetExportNameMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected