| 791 | } |
| 792 | |
| 793 | bool cmComputeLinkInformation::AddLibraryFeature(std::string const& feature) |
| 794 | { |
| 795 | auto it = this->LibraryFeatureDescriptors.find(feature); |
| 796 | if (it != this->LibraryFeatureDescriptors.end()) { |
| 797 | return it->second.Supported; |
| 798 | } |
| 799 | |
| 800 | auto featureName = |
| 801 | cmStrCat("CMAKE_", this->LinkLanguage, "_LINK_LIBRARY_USING_", feature); |
| 802 | cmValue featureSupported = |
| 803 | this->Makefile->GetDefinition(cmStrCat(featureName, "_SUPPORTED")); |
| 804 | if (!featureSupported) { |
| 805 | // language specific variable is not defined, fallback to the more generic |
| 806 | // one |
| 807 | featureName = cmStrCat("CMAKE_LINK_LIBRARY_USING_", feature); |
| 808 | featureSupported = |
| 809 | this->Makefile->GetDefinition(cmStrCat(featureName, "_SUPPORTED")); |
| 810 | } |
| 811 | if (!featureSupported.IsOn()) { |
| 812 | this->LibraryFeatureDescriptors.emplace(feature, FeatureDescriptor{}); |
| 813 | |
| 814 | this->CMakeInstance->IssueMessage( |
| 815 | MessageType::FATAL_ERROR, |
| 816 | cmStrCat( |
| 817 | "Feature '", feature, |
| 818 | "', specified through generator-expression '$<LINK_LIBRARY>' to " |
| 819 | "link target '", |
| 820 | this->Target->GetName(), "', is not supported for the '", |
| 821 | this->LinkLanguage, "' link language."), |
| 822 | this->Target->GetBacktrace()); |
| 823 | |
| 824 | return false; |
| 825 | } |
| 826 | |
| 827 | cmValue langFeature = this->Makefile->GetDefinition(featureName); |
| 828 | if (!langFeature) { |
| 829 | this->LibraryFeatureDescriptors.emplace(feature, FeatureDescriptor{}); |
| 830 | |
| 831 | this->CMakeInstance->IssueMessage( |
| 832 | MessageType::FATAL_ERROR, |
| 833 | cmStrCat( |
| 834 | "Feature '", feature, |
| 835 | "', specified through generator-expression '$<LINK_LIBRARY>' to " |
| 836 | "link target '", |
| 837 | this->Target->GetName(), "', is not defined for the '", |
| 838 | this->LinkLanguage, "' link language."), |
| 839 | this->Target->GetBacktrace()); |
| 840 | |
| 841 | return false; |
| 842 | } |
| 843 | |
| 844 | auto items = cmExpandListWithBacktrace( |
| 845 | *langFeature, this->Target->GetBacktrace(), cmList::EmptyElements::Yes); |
| 846 | |
| 847 | if ((items.size() == 1 && !IsValidFeatureFormat(items.front().Value)) || |
| 848 | (items.size() == 3 && !IsValidFeatureFormat(items[1].Value))) { |
| 849 | this->LibraryFeatureDescriptors.emplace(feature, FeatureDescriptor{}); |
| 850 | this->CMakeInstance->IssueMessage( |
no test coverage detected