mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
Merge topic 'xcode-framework-path'
5389bb4274Xcode: Don't hard-code SDK-provided implicit framework search pathsdf08f8df30cmComputeLinkInformation: Fix misspelt private variable name375b307baeApple: Fix linking to frameworks that do not exist until build time Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5760
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user