summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-09-15 15:09:07 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2022-09-21 14:14:36 (GMT)
commit0bd3efffbc97783bf8b1a6dcf3132a1bca84dce9 (patch)
treece8505ac8a9c7a8e9c09a0ee0af5beebae522682 /Source/cmGlobalGenerator.cxx
parent2ce95133d65ed44e69543b286e47d768dbceff2b (diff)
downloadCMake-0bd3efffbc97783bf8b1a6dcf3132a1bca84dce9.zip
CMake-0bd3efffbc97783bf8b1a6dcf3132a1bca84dce9.tar.gz
CMake-0bd3efffbc97783bf8b1a6dcf3132a1bca84dce9.tar.bz2
Genex LINK_LIBRARY: Add support for framework with postfix
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 8130521..6962b52 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2563,9 +2563,9 @@ bool cmGlobalGenerator::NameResolvesToFramework(
// 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)
-cm::optional<std::pair<std::string, std::string>>
+cm::optional<cmGlobalGenerator::FrameworkDescriptor>
cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
- bool extendedFormat) const
+ FrameworkFormat format) const
{
// Check for framework structure:
// (/path/to/)?FwName.framework
@@ -2580,20 +2580,29 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
auto name = frameworkPath.match(3);
auto libname =
cmSystemTools::GetFilenameWithoutExtension(frameworkPath.match(6));
+ if (format == FrameworkFormat::Strict && libname.empty()) {
+ return cm::nullopt;
+ }
if (!libname.empty() && !cmHasPrefix(libname, name)) {
return cm::nullopt;
}
- return std::pair<std::string, std::string>{ frameworkPath.match(2), name };
+
+ if (libname.empty() || name.size() == libname.size()) {
+ return FrameworkDescriptor{ frameworkPath.match(2), name };
+ }
+
+ return FrameworkDescriptor{ frameworkPath.match(2), name,
+ libname.substr(name.size()) };
}
- if (extendedFormat) {
+ if (format == FrameworkFormat::Extended) {
// path format can be more flexible: (/path/to/)?fwName(.framework)?
auto fwDir = cmSystemTools::GetParentDirectory(path);
auto name = cmSystemTools::GetFilenameLastExtension(path) == ".framework"
? cmSystemTools::GetFilenameWithoutExtension(path)
: cmSystemTools::GetFilenameName(path);
- return std::pair<std::string, std::string>{ fwDir, name };
+ return FrameworkDescriptor{ fwDir, name };
}
return cm::nullopt;