| 1723 | } |
| 1724 | |
| 1725 | std::string cmLocalGenerator::GetFrameworkFlags(std::string const& lang, |
| 1726 | std::string const& config, |
| 1727 | cmGeneratorTarget* target) |
| 1728 | { |
| 1729 | cmLocalGenerator* lg = target->GetLocalGenerator(); |
| 1730 | cmMakefile* mf = lg->GetMakefile(); |
| 1731 | |
| 1732 | if (!target->IsApple()) { |
| 1733 | return std::string(); |
| 1734 | } |
| 1735 | |
| 1736 | cmValue fwSearchFlag = |
| 1737 | mf->GetDefinition(cmStrCat("CMAKE_", lang, "_FRAMEWORK_SEARCH_FLAG")); |
| 1738 | cmValue sysFwSearchFlag = mf->GetDefinition( |
| 1739 | cmStrCat("CMAKE_", lang, "_SYSTEM_FRAMEWORK_SEARCH_FLAG")); |
| 1740 | |
| 1741 | if (!fwSearchFlag && !sysFwSearchFlag) { |
| 1742 | return std::string{}; |
| 1743 | } |
| 1744 | |
| 1745 | std::set<std::string> emitted; |
| 1746 | #ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ |
| 1747 | emitted.insert("/System/Library/Frameworks"); |
| 1748 | #endif |
| 1749 | std::vector<std::string> includes; |
| 1750 | |
| 1751 | lg->GetIncludeDirectories(includes, target, "C", config); |
| 1752 | // check all include directories for frameworks as this |
| 1753 | // will already have added a -F for the framework |
| 1754 | for (std::string const& include : includes) { |
| 1755 | if (lg->GetGlobalGenerator()->NameResolvesToFramework(include)) { |
| 1756 | std::string frameworkDir = cmStrCat(include, "/../"); |
| 1757 | frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); |
| 1758 | emitted.insert(frameworkDir); |
| 1759 | } |
| 1760 | } |
| 1761 | |
| 1762 | std::string flags; |
| 1763 | if (cmComputeLinkInformation* cli = target->GetLinkInformation(config)) { |
| 1764 | std::vector<std::string> const& frameworks = cli->GetFrameworkPaths(); |
| 1765 | for (std::string const& framework : frameworks) { |
| 1766 | if (emitted.insert(framework).second) { |
| 1767 | if (sysFwSearchFlag && |
| 1768 | target->IsSystemIncludeDirectory(framework, config, lang)) { |
| 1769 | flags += *sysFwSearchFlag; |
| 1770 | } else { |
| 1771 | flags += *fwSearchFlag; |
| 1772 | } |
| 1773 | flags += |
| 1774 | lg->ConvertToOutputFormat(framework, cmOutputConverter::SHELL); |
| 1775 | flags += " "; |
| 1776 | } |
| 1777 | } |
| 1778 | } |
| 1779 | return flags; |
| 1780 | } |
| 1781 | |
| 1782 | std::string cmLocalGenerator::GetXcFrameworkFlags(std::string const& lang, |
no test coverage detected