From 5dc23300b1c320db1e0690f769c4fda11adc6376 Mon Sep 17 00:00:00 2001 From: Gusts Kaksis Date: Tue, 27 Oct 2020 10:06:07 +0200 Subject: 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 --- Source/cmGlobalXCodeGenerator.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 952a179..e7bbf72 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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); } -- cgit v0.12