diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-02-03 12:03:00 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-02-03 12:11:21 (GMT) |
commit | 5389bb4274f80b69e45aceffbdf3ffdb1e79908f (patch) | |
tree | 36aa0599b6baf9cd28cca21e55f17e2dc94b25d7 /Source/cmGlobalXCodeGenerator.cxx | |
parent | df08f8df3027db25eb1cb75fb6017c3a8c046674 (diff) | |
download | CMake-5389bb4274f80b69e45aceffbdf3ffdb1e79908f.zip CMake-5389bb4274f80b69e45aceffbdf3ffdb1e79908f.tar.gz CMake-5389bb4274f80b69e45aceffbdf3ffdb1e79908f.tar.bz2 |
Xcode: Don't hard-code SDK-provided implicit framework search paths
When a framework is linked to a target by its full path and that
framework is located in one of the implicit framework search directories,
CMake 3.18.5 and earlier discarded that path.
ce2dee9e5ba (Xcode: Don't add framework as -framework argument in
linker info list, 2020-09-28) introduced a regression which resulted in
the framework path always being added to the search path even if it
matched one of the implicit search paths. This broke the ability to do
device and simulator builds from the same configured project.
Fixes: #21678
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index df45b35..51a7915 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3620,6 +3620,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; @@ -3633,7 +3642,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)); |