| 724 | } |
| 725 | |
| 726 | void cmPackageInfoReader::SetTargetProperties( |
| 727 | cmMakefile* makefile, cmTarget* target, Json::Value const& data, |
| 728 | std::string const& package, cm::string_view configuration) const |
| 729 | { |
| 730 | // Add configuration (if applicable). |
| 731 | if (!configuration.empty()) { |
| 732 | this->AddTargetConfiguration(target, configuration); |
| 733 | } |
| 734 | |
| 735 | // Add compile and link features. |
| 736 | for (std::string const& def : ReadList(data, "compile_features")) { |
| 737 | AddCompileFeature(makefile, target, configuration, def); |
| 738 | } |
| 739 | |
| 740 | for (std::string const& def : ReadList(data, "link_features")) { |
| 741 | AddLinkFeature(makefile, target, configuration, def); |
| 742 | } |
| 743 | |
| 744 | // Add compile definitions. |
| 745 | Json::Value const& defs = data["definitions"]; |
| 746 | DefinitionsMap definitionsMap; |
| 747 | for (auto ldi = defs.begin(), lde = defs.end(); ldi != lde; ++ldi) { |
| 748 | cm::string_view const originalLang = IterKey(ldi); |
| 749 | cm::string_view const lang = MapLanguage(originalLang); |
| 750 | if (lang.empty()) { |
| 751 | makefile->IssueMessage( |
| 752 | MessageType::WARNING, |
| 753 | cmStrCat(R"(ignoring unknown language ")"_s, originalLang, |
| 754 | R"(" in definitions for )"_s, target->GetName())); |
| 755 | continue; |
| 756 | } |
| 757 | |
| 758 | for (auto di = ldi->begin(), de = ldi->end(); di != de; ++di) { |
| 759 | definitionsMap[di.name()].emplace(lang, *di); |
| 760 | } |
| 761 | } |
| 762 | AddDefinitions(makefile, target, configuration, definitionsMap); |
| 763 | |
| 764 | // Add include directories. |
| 765 | AppendLanguageProperties(makefile, target, "INCLUDE_DIRECTORIES"_s, |
| 766 | configuration, data, "includes", |
| 767 | [this](std::string p) -> std::string { |
| 768 | return this->ResolvePath(std::move(p)); |
| 769 | }); |
| 770 | |
| 771 | // Add link name/location(s). |
| 772 | this->SetImportProperty(makefile, target, "LOCATION"_s, // br |
| 773 | configuration, data, "location"); |
| 774 | |
| 775 | this->SetImportProperty(makefile, target, "IMPLIB"_s, // br |
| 776 | configuration, data, "link_location"); |
| 777 | |
| 778 | this->SetImportProperty(makefile, target, "SONAME"_s, // br |
| 779 | configuration, data, "link_name"); |
| 780 | |
| 781 | // Add link languages. |
| 782 | for (std::string const& originalLang : ReadList(data, "link_languages")) { |
| 783 | cm::string_view const lang = MapLanguage(originalLang, DisallowGlob); |
no test coverage detected