| 866 | } |
| 867 | |
| 868 | cmLinkInterface const* cmGeneratorTarget::GetImportLinkInterface( |
| 869 | std::string const& config, cmGeneratorTarget const* headTarget, UseTo usage, |
| 870 | bool secondPass) const |
| 871 | { |
| 872 | cmGeneratorTarget::ImportInfo const* info = this->GetImportInfo(config); |
| 873 | if (!info) { |
| 874 | return nullptr; |
| 875 | } |
| 876 | |
| 877 | cmHeadToLinkInterfaceMap& hm = |
| 878 | (usage == UseTo::Compile |
| 879 | ? this->GetHeadToLinkInterfaceUsageRequirementsMap(config) |
| 880 | : this->GetHeadToLinkInterfaceMap(config)); |
| 881 | |
| 882 | // If the link interface does not depend on the head target |
| 883 | // then reuse the one from the head we computed first. |
| 884 | if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) { |
| 885 | headTarget = hm.begin()->first; |
| 886 | } |
| 887 | |
| 888 | cmOptionalLinkInterface& iface = hm[headTarget]; |
| 889 | if (secondPass) { |
| 890 | iface = cmOptionalLinkInterface(); |
| 891 | } |
| 892 | MaybeEnableCheckLinkLibraries(iface); |
| 893 | if (!iface.AllDone) { |
| 894 | iface.AllDone = true; |
| 895 | iface.LibrariesDone = true; |
| 896 | iface.Multiplicity = info->Multiplicity; |
| 897 | cmExpandList(info->Languages, iface.Languages); |
| 898 | this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT, |
| 899 | cmMakeRange(info->LibrariesHeadInclude), config, |
| 900 | headTarget, usage, LinkInterfaceField::HeadInclude, |
| 901 | iface); |
| 902 | this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE, |
| 903 | cmMakeRange(info->LibrariesHeadExclude), config, |
| 904 | headTarget, usage, LinkInterfaceField::HeadExclude, |
| 905 | iface); |
| 906 | this->ExpandLinkItems(info->LibrariesProp, cmMakeRange(info->Libraries), |
| 907 | config, headTarget, usage, |
| 908 | LinkInterfaceField::Libraries, iface); |
| 909 | cmList deps{ info->SharedDeps }; |
| 910 | LookupLinkItemScope scope{ this->LocalGenerator }; |
| 911 | |
| 912 | auto linkFeature = cmLinkItem::DEFAULT; |
| 913 | for (auto const& dep : deps) { |
| 914 | if (auto maybeLinkFeature = ParseLinkFeature(dep)) { |
| 915 | linkFeature = std::move(*maybeLinkFeature); |
| 916 | continue; |
| 917 | } |
| 918 | |
| 919 | if (cm::optional<cmLinkItem> maybeItem = this->LookupLinkItem( |
| 920 | dep, cmListFileBacktrace(), linkFeature, &scope, LookupSelf::No)) { |
| 921 | iface.SharedDeps.emplace_back(std::move(*maybeItem)); |
| 922 | } |
| 923 | } |
| 924 | } |
| 925 |
no test coverage detected