summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGusts Kaksis <gusts.kaksis@sonarworks.com>2020-10-27 08:06:07 (GMT)
committerBrad King <brad.king@kitware.com>2020-10-27 11:12:26 (GMT)
commit5dc23300b1c320db1e0690f769c4fda11adc6376 (patch)
tree0732d66d59e8a2ca37d1abcc9dece75e68894727
parent96ea613f169cedc4087b536d95ca6c128b8f4eb6 (diff)
downloadCMake-5dc23300b1c320db1e0690f769c4fda11adc6376.zip
CMake-5dc23300b1c320db1e0690f769c4fda11adc6376.tar.gz
CMake-5dc23300b1c320db1e0690f769c4fda11adc6376.tar.bz2
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
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
1 files 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);
}