summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorGusts Kaksis <gusts.kaksis@sonarworks.com>2020-09-28 18:16:52 (GMT)
committerCraig Scott <craig.scott@crascit.com>2020-10-02 12:13:00 (GMT)
commitce2dee9e5bae37c8117087bb83add075c3c123b4 (patch)
tree51a3e6d9194afd96bbc2e6dbbe9b8a9fd3e7057a /Source
parent468bcc3291ac3f325b401046b2465d634d8e3947 (diff)
downloadCMake-ce2dee9e5bae37c8117087bb83add075c3c123b4.zip
CMake-ce2dee9e5bae37c8117087bb83add075c3c123b4.tar.gz
CMake-ce2dee9e5bae37c8117087bb83add075c3c123b4.tar.bz2
Xcode: Don't add framework as -framework argument in linker info list
Diffstat (limited to 'Source')
-rw-r--r--Source/cmComputeLinkInformation.cxx16
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
2 files changed, 20 insertions, 6 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 4a331fb..201a9d9 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1293,11 +1293,17 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
// add runtime information
this->AddLibraryRuntimeInfo(full_fw);
- // Add the item using the -framework option.
- this->Items.emplace_back(std::string("-framework"), false);
- cmOutputConverter converter(this->Makefile->GetStateSnapshot());
- fw = converter.EscapeForShell(fw);
- this->Items.emplace_back(fw, false);
+ if (this->GlobalGenerator->IsXcode()) {
+ // Add framework path - it will be handled by Xcode after it's added to
+ // "Link Binary With Libraries" build phase
+ this->Items.emplace_back(item, true);
+ } else {
+ // Add the item using the -framework option.
+ this->Items.emplace_back(std::string("-framework"), false);
+ cmOutputConverter converter(this->Makefile->GetStateSnapshot());
+ fw = converter.EscapeForShell(fw);
+ this->Items.emplace_back(fw, false);
+ }
}
void cmComputeLinkInformation::AddDirectoryItem(std::string const& item)
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index acae2b6..f1a1ce6 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3579,8 +3579,16 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
for (auto const& libItem : configItemMap[configName]) {
auto const& libName = *libItem;
if (libName.IsPath) {
- libPaths.Add(this->XCodeEscapePath(libName.Value.Value));
const auto libPath = GetLibraryOrFrameworkPath(libName.Value.Value);
+ if (cmSystemTools::StringEndsWith(libPath.c_str(), ".framework")) {
+ const auto fwName =
+ cmSystemTools::GetFilenameWithoutExtension(libPath);
+ const auto fwDir = cmSystemTools::GetParentDirectory(libPath);
+ libPaths.Add("-F " + this->XCodeEscapePath(fwDir));
+ libPaths.Add("-framework " + fwName);
+ } else {
+ libPaths.Add(this->XCodeEscapePath(libName.Value.Value));
+ }
if ((!libName.Target || libName.Target->IsImported()) &&
IsLinkPhaseLibraryExtension(libPath)) {
// Create file reference for embedding