summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-04 13:18:13 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-02-04 13:18:21 (GMT)
commite8ae5d1c32e5598df3711757c7ab44044f3018aa (patch)
tree00452acef3cb618c4667e6c01f999aeb9ef64f51 /Source/cmGlobalXCodeGenerator.cxx
parent388ffeb586866d20ba1b52c8870e26cea64cf4dc (diff)
parent5389bb4274f80b69e45aceffbdf3ffdb1e79908f (diff)
downloadCMake-e8ae5d1c32e5598df3711757c7ab44044f3018aa.zip
CMake-e8ae5d1c32e5598df3711757c7ab44044f3018aa.tar.gz
CMake-e8ae5d1c32e5598df3711757c7ab44044f3018aa.tar.bz2
Merge topic 'xcode-framework-path'
5389bb4274 Xcode: Don't hard-code SDK-provided implicit framework search paths df08f8df30 cmComputeLinkInformation: Fix misspelt private variable name 375b307bae Apple: Fix linking to frameworks that do not exist until build time Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5760
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 60d108b..891f37b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3666,6 +3666,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// now add the left-over link libraries
{
+ // Keep track of framework search paths we've already added or that are
+ // part of the set of implicit search paths. We don't want to repeat
+ // them and we also need to avoid hard-coding any SDK-specific paths.
+ // This is essential for getting device-and-simulator builds to work,
+ // otherwise we end up hard-coding a path to the wrong SDK for
+ // SDK-provided frameworks that are added by their full path.
+ std::set<std::string> emitted(cli->GetFrameworkPathsEmitted());
+ const auto& fwPaths = cli->GetFrameworkPaths();
+ emitted.insert(fwPaths.begin(), fwPaths.end());
BuildObjectListOrString libPaths(this, true);
for (auto const& libItem : configItemMap[configName]) {
auto const& libName = *libItem;
@@ -3679,7 +3688,11 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
const auto fwName =
cmSystemTools::GetFilenameWithoutExtension(libPath);
const auto fwDir = cmSystemTools::GetParentDirectory(libPath);
- libPaths.Add("-F " + this->XCodeEscapePath(fwDir));
+ if (emitted.insert(fwDir).second) {
+ // This is a search path we had not added before and it isn't an
+ // implicit search path, so we need it
+ libPaths.Add("-F " + this->XCodeEscapePath(fwDir));
+ }
libPaths.Add("-framework " + fwName);
} else {
libPaths.Add(this->XCodeEscapePath(cleanPath));