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

Method ComputeLinkInterface

Source/cmGeneratorTarget_Link.cxx:673–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673void cmGeneratorTarget::ComputeLinkInterface(std::string const& config,
674 cmOptionalLinkInterface& iface,
675 bool secondPass) const
676{
677 if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
678 this->GetType() == cmStateEnums::STATIC_LIBRARY ||
679 this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
680 // Shared libraries may have runtime implementation dependencies
681 // on other shared libraries that are not in the interface.
682 std::set<cmLinkItem> emitted;
683 for (cmLinkItem const& lib : iface.Libraries) {
684 emitted.insert(lib);
685 }
686 if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
687 cmLinkImplementation const* impl =
688 this->GetLinkImplementation(config, UseTo::Link, secondPass);
689 for (cmLinkItem const& lib : impl->Libraries) {
690 if (emitted.insert(lib).second) {
691 if (lib.Target) {
692 // This is a runtime dependency on another shared library.
693 if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
694 iface.SharedDeps.push_back(lib);
695 }
696 } else {
697 // TODO: Recognize shared library file names. Perhaps this
698 // should be moved to cmComputeLinkInformation, but that
699 // creates a chicken-and-egg problem since this list is needed
700 // for its construction.
701 }
702 }
703 }
704 }
705 }
706
707 if (this->LinkLanguagePropagatesToDependents()) {
708 // Targets using this archive need its language runtime libraries.
709 if (cmLinkImplementation const* impl =
710 this->GetLinkImplementation(config, UseTo::Link, secondPass)) {
711 iface.Languages = impl->Languages;
712 }
713 }
714
715 if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
716 // Construct the property name suffix for this configuration.
717 std::string suffix = "_";
718 if (!config.empty()) {
719 suffix += cmSystemTools::UpperCase(config);
720 } else {
721 suffix += "NOCONFIG";
722 }
723
724 // How many repetitions are needed if this library has cyclic
725 // dependencies?
726 std::string propName = cmStrCat("LINK_INTERFACE_MULTIPLICITY", suffix);
727 if (cmValue config_reps = this->GetProperty(propName)) {
728 sscanf(config_reps->c_str(), "%u", &iface.Multiplicity);
729 } else if (cmValue reps =
730 this->GetProperty("LINK_INTERFACE_MULTIPLICITY")) {

Callers 1

GetLinkInterfaceMethod · 0.95

Calls 10

GetTypeMethod · 0.95
GetLinkImplementationMethod · 0.95
GetPropertyMethod · 0.95
push_backMethod · 0.80
c_strMethod · 0.80
cmStrCatFunction · 0.70
insertMethod · 0.45
GetTypeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected