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

Method SetImportDetailProperties

Source/cmExportFileGenerator.cxx:517–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517void cmExportFileGenerator::SetImportDetailProperties(
518 std::string const& config, std::string const& suffix,
519 cmGeneratorTarget const* target, ImportPropertyMap& properties)
520{
521 // Get the makefile in which to lookup target information.
522 cmMakefile* mf = target->Makefile;
523
524 // Add the soname for unix shared libraries.
525 if (target->GetType() == cmStateEnums::SHARED_LIBRARY ||
526 target->GetType() == cmStateEnums::MODULE_LIBRARY) {
527 if (!target->IsDLLPlatform()) {
528 std::string prop;
529 std::string value;
530 if (target->HasSOName(config)) {
531 if (mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) {
532 value = this->InstallNameDir(target, config);
533 }
534 prop = "IMPORTED_SONAME";
535 value += target->GetSOName(config);
536 } else {
537 prop = "IMPORTED_NO_SONAME";
538 value = "TRUE";
539 }
540 prop += suffix;
541 properties[prop] = value;
542 }
543 }
544
545 // Add the transitive link dependencies for this configuration.
546 if (cmLinkInterface const* iface =
547 target->GetLinkInterface(config, target)) {
548 this->SetImportLinkProperty(
549 suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", iface->Languages,
550 properties, ImportLinkPropertyTargetNames::No);
551
552 // Export IMPORTED_LINK_DEPENDENT_LIBRARIES to help consuming linkers
553 // find private dependencies of shared libraries.
554 std::size_t oldMissingTargetsSize = this->MissingTargets.size();
555 auto oldExternalTargets = this->ExternalTargets;
556 this->SetImportLinkProperty(
557 suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", iface->SharedDeps,
558 properties, ImportLinkPropertyTargetNames::Yes);
559 // Avoid enforcing shared library private dependencies as public package
560 // dependencies by ignoring missing targets added for them.
561 this->MissingTargets.resize(oldMissingTargetsSize);
562 this->ExternalTargets = std::move(oldExternalTargets);
563
564 if (iface->Multiplicity > 0) {
565 std::string prop =
566 cmStrCat("IMPORTED_LINK_INTERFACE_MULTIPLICITY", suffix);
567 properties[prop] = std::to_string(iface->Multiplicity);
568 }
569 }
570
571 // Add information if this target is a managed target
572 if (target->GetManagedType(config) !=
573 cmGeneratorTarget::ManagedType::Native) {
574 std::string prop = cmStrCat("IMPORTED_COMMON_LANGUAGE_RUNTIME", suffix);

Calls 15

SetImportLinkPropertyMethod · 0.95
moveFunction · 0.85
to_stringFunction · 0.85
HasSONameMethod · 0.80
GetLinkInterfaceMethod · 0.80
GetManagedTypeMethod · 0.80
IsCSharpOnlyMethod · 0.80
cmStrCatFunction · 0.70
GetTypeMethod · 0.45
IsDLLPlatformMethod · 0.45
IsOnMethod · 0.45
InstallNameDirMethod · 0.45

Tested by

no test coverage detected