If the file has no extension it's either a raw executable or might be a direct reference to a binary within a framework (bad practice!). This is where we change the path to point to the framework directory. .tbd files also can be located in SDK frameworks (they are placeholders for actual libraries shipped with the OS)
| 2832 | // .tbd files also can be located in SDK frameworks (they are |
| 2833 | // placeholders for actual libraries shipped with the OS) |
| 2834 | cm::optional<cmGlobalGenerator::FrameworkDescriptor> |
| 2835 | cmGlobalGenerator::SplitFrameworkPath(std::string const& path, |
| 2836 | FrameworkFormat format) const |
| 2837 | { |
| 2838 | // Check for framework structure: |
| 2839 | // (/path/to/)?FwName.framework |
| 2840 | // or (/path/to/)?FwName.framework/FwName(.tbd)? |
| 2841 | // or (/path/to/)?FwName.framework/Versions/*/FwName(.tbd)? |
| 2842 | static cmsys::RegularExpression frameworkPath( |
| 2843 | "((.+)/)?([^/]+)\\.framework(/Versions/([^/]+))?(/(.+))?$"); |
| 2844 | |
| 2845 | auto ext = cmSystemTools::GetFilenameLastExtensionView(path); |
| 2846 | if ((ext.empty() || ext == ".tbd" || ext == ".framework") && |
| 2847 | frameworkPath.find(path)) { |
| 2848 | auto name = frameworkPath.match(3); |
| 2849 | auto libname = |
| 2850 | cmSystemTools::GetFilenameWithoutExtension(frameworkPath.match(7)); |
| 2851 | if (format == FrameworkFormat::Strict && libname.empty()) { |
| 2852 | return cm::nullopt; |
| 2853 | } |
| 2854 | if (!libname.empty() && !cmHasPrefix(libname, name)) { |
| 2855 | return cm::nullopt; |
| 2856 | } |
| 2857 | |
| 2858 | if (libname.empty() || name.size() == libname.size()) { |
| 2859 | return FrameworkDescriptor{ frameworkPath.match(2), |
| 2860 | frameworkPath.match(5), name }; |
| 2861 | } |
| 2862 | |
| 2863 | return FrameworkDescriptor{ frameworkPath.match(2), frameworkPath.match(5), |
| 2864 | name, libname.substr(name.size()) }; |
| 2865 | } |
| 2866 | |
| 2867 | if (format == FrameworkFormat::Extended) { |
| 2868 | // path format can be more flexible: (/path/to/)?fwName(.framework)? |
| 2869 | auto fwDir = cmSystemTools::GetParentDirectory(path); |
| 2870 | auto name = ext == ".framework" |
| 2871 | ? cmSystemTools::GetFilenameWithoutExtension(path) |
| 2872 | : cmSystemTools::GetFilenameName(path); |
| 2873 | |
| 2874 | return FrameworkDescriptor{ fwDir, name }; |
| 2875 | } |
| 2876 | |
| 2877 | return cm::nullopt; |
| 2878 | } |
| 2879 | |
| 2880 | namespace { |
| 2881 | void IssueReservedTargetNameError(cmake* cm, cmTarget* tgt, |
no test coverage detected