diff options
author | Brad King <brad.king@kitware.com> | 2021-05-21 14:39:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-05-21 14:39:31 (GMT) |
commit | 2d3114c9b82a9763cdd3caaee44a202b71b5baeb (patch) | |
tree | c85226586779c85cc80d8d83ea739fde22945a71 /Source | |
parent | 96995d38cd71236c1e6610d0e48f271d55665ce8 (diff) | |
parent | 820d3afb2881265a811cffd42b66f9288932bf1d (diff) | |
download | CMake-2d3114c9b82a9763cdd3caaee44a202b71b5baeb.zip CMake-2d3114c9b82a9763cdd3caaee44a202b71b5baeb.tar.gz CMake-2d3114c9b82a9763cdd3caaee44a202b71b5baeb.tar.bz2 |
Merge topic 'imported-framework-soname-file'
820d3afb28 Framework: Fix $<TARGET_SONAME_FILE:...> for imported frameworks
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !6147
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index bbc0050..e2ec82a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -52,6 +52,11 @@ class cmMessenger; +namespace { +const cmsys::RegularExpression FrameworkRegularExpression( + "^(.*/)?([^/]*)\\.framework/(.*)$"); +} + template <> cmProp cmTargetPropertyComputer::GetSources<cmGeneratorTarget>( cmGeneratorTarget const* tgt, cmMessenger* /* messenger */, @@ -2257,8 +2262,16 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const return cmSystemTools::GetFilenameName(info->Location); } // Use the soname given if any. + if (this->IsFrameworkOnApple()) { + cmsys::RegularExpressionMatch match; + if (FrameworkRegularExpression.find(info->SOName.c_str(), match)) { + auto frameworkName = match.match(2); + auto fileName = match.match(3); + return cmStrCat(frameworkName, ".framework/", fileName); + } + } if (cmHasLiteralPrefix(info->SOName, "@rpath/")) { - return info->SOName.substr(6); + return info->SOName.substr(cmStrLen("@rpath/")); } return info->SOName; } @@ -6459,9 +6472,19 @@ std::string cmGeneratorTarget::GetDirectory( const std::string& config, cmStateEnums::ArtifactType artifact) const { if (this->IsImported()) { + auto fullPath = this->Target->ImportedGetFullPath(config, artifact); + if (this->IsFrameworkOnApple()) { + cmsys::RegularExpressionMatch match; + if (FrameworkRegularExpression.find(fullPath.c_str(), match)) { + auto path = match.match(1); + if (!path.empty()) { + path.erase(path.length() - 1); + } + return path; + } + } // Return the directory from which the target is imported. - return cmSystemTools::GetFilenamePath( - this->Target->ImportedGetFullPath(config, artifact)); + return cmSystemTools::GetFilenamePath(fullPath); } if (OutputInfo const* info = this->GetOutputInfo(config)) { // Return the directory in which the target will be built. |