Xcode: Don't add framework as -framework argument in linker info list

This commit is contained in:
Gusts Kaksis
2020-09-28 21:16:52 +03:00
committed by Craig Scott
parent 468bcc3291
commit ce2dee9e5b
7 changed files with 78 additions and 17 deletions
+11 -5
View File
@@ -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)
+9 -1
View File
@@ -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