diff options
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 12 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 15 |
3 files changed, 25 insertions, 5 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index f32f9e9..6225a4a 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -474,6 +474,12 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths() return this->FrameworkPaths; } +std::set<std::string> const& +cmComputeLinkInformation::GetFrameworkPathsEmitted() const +{ + return this->FrameworkPathsEmitted; +} + const std::set<const cmGeneratorTarget*>& cmComputeLinkInformation::GetSharedLibrariesLinked() const { @@ -1339,8 +1345,8 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() "CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"); this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec); - this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(), - implicitDirVec.end()); + this->FrameworkPathsEmitted.insert(implicitDirVec.begin(), + implicitDirVec.end()); // Regular expression to extract a framework path and name. this->SplitFramework.compile("(.*)/(.*)\\.framework$"); @@ -1348,7 +1354,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() void cmComputeLinkInformation::AddFrameworkPath(std::string const& p) { - if (this->FrameworkPathsEmmitted.insert(p).second) { + if (this->FrameworkPathsEmitted.insert(p).second) { this->FrameworkPaths.push_back(p); } } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index ec8d73c..9fec702 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -55,6 +55,7 @@ public: std::vector<BT<std::string>> GetDirectoriesWithBacktraces(); std::vector<std::string> const& GetDepends() const; std::vector<std::string> const& GetFrameworkPaths() const; + std::set<std::string> const& GetFrameworkPathsEmitted() const; std::string GetLinkLanguage() const { return this->LinkLanguage; } std::vector<std::string> const& GetRuntimeSearchPath() const; std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; } @@ -164,7 +165,7 @@ private: // Framework info. void ComputeFrameworkInfo(); void AddFrameworkPath(std::string const& p); - std::set<std::string> FrameworkPathsEmmitted; + std::set<std::string> FrameworkPathsEmitted; cmsys::RegularExpression SplitFramework; // Linker search path computation. 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)); |