Xcode: Fix regression that automatically links libraries in source list

In commit e637744c51 (Xcode: Use "Link Binary With Libraries" to link
any library, 2019-07-10, v3.19.0-rc1~494^2~1) we accidentally added all
the library type files to "Link Binary With Libraries" build phase if
they were passed in as source files.  Revert that change as any actually
linked libraries will be added to that build phase later in the
`AddDependAndLinkInformation` call.

Fixes: #21361
This commit is contained in:
Gusts Kaksis
2020-10-27 10:06:07 +02:00
committed by Brad King
parent 96ea613f16
commit 5dc23300b1

View File

@@ -1423,7 +1423,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
cmGeneratorTarget::SourceFileFlags tsFlags =
gtgt->GetTargetSourceFileFlags(sourceFile);
if (filetype && IsLibraryType(filetype->GetString())) {
if (filetype && filetype->GetString() == "compiled.mach-o.objfile") {
if (sourceFile->GetObjectLibrary().empty()) {
externalObjFiles.push_back(xsf);
}
@@ -1591,7 +1591,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
}
}
// always create framework build phase
// Always create Link Binary With Libraries build phase
cmXCodeObject* frameworkBuildPhase = nullptr;
frameworkBuildPhase =
this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase);
@@ -1600,6 +1600,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
this->CreateString("2147483647"));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
frameworkBuildPhase->AddAttribute("files", buildFiles);
// Add all collected .o files to this build phase
for (auto& externalObjFile : externalObjFiles) {
buildFiles->AddObject(externalObjFile);
}