Commit 2bc22bda authored by Brad King's avatar Brad King

Xcode: Add frameworks search paths from link dependeny closure (#13397)

The Xcode generator produces FRAMEWORK_SEARCH_PATHS from:

(1) Include directories of the form /path/to/Foo.framework become
    -F/path/to so '#include <Foo/H>' can find H in the framework.

(2) Linked frameworks of the form /path/to/Foo.framework become
    -F/path/to -framework Foo so the linker can find the framework.

Originally commit 82bb6fae (add framework support to FIND_FILE,
2005-12-27) added these and used the (then current) old-style link
dependency analysis results to get the frameworks.  Later a second
setting was added by commit 2ed6191f (add initial xcode framework stuff,
2007-05-08) to transform -F/path/to linker options produced by the old
link line generation into entries appended to FRAMEWORK_SEARCH_PATHS.
Then commit 96fd5909 (Implement linking with paths to library files,
2008-01-22) updated the second setting to directly use the results of
full modern link dependency analysis, but forgot to remove the use of
old-style link results from the original setting location.

The two settings worked together for a while, with the second one
appending to the first.  Then commit f33a27ab (Generate native Xcode 3.0
and 3.1 projects, 2009-06-29) changed the internal representation format
produced by the first setting but did not update the second setting to
append to the new representation.  As a result, if the first setting
added any paths (usually via the old-style link analysis) then the
second setting containing the modern link analysis results would not be
applied at all.

Fix this by removing use of the old-style link analysis results.
Replace it using the modern link dependencies and remove the second
setting altogether.  Now all values for FRAMEWORK_SEARCH_PATHS are
collected in one place so no special append logic is needed.
parent 8521a9e9
......@@ -1997,15 +1997,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::vector<std::string>& frameworks = target.GetFrameworks();
if(target.GetType() != cmTarget::OBJECT_LIBRARY &&
target.GetType() != cmTarget::STATIC_LIBRARY)
for(std::vector<std::string>::iterator fmIt = frameworks.begin();
fmIt != frameworks.end(); ++fmIt)
// Add framework search paths needed for linking.
if(cmComputeLinkInformation* cli = target.GetLinkInformation(configName))
std::vector<std::string> const& fwDirs = cli->GetFrameworkPaths();
for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
fdi != fwDirs.end(); ++fdi)
......@@ -2691,25 +2696,6 @@ void cmGlobalXCodeGenerator
linkDirs.c_str(), configName);
// add the framework search paths
const char* sep = "";
std::string fdirs;
std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
fdi != fwDirs.end(); ++fdi)
fdirs += sep;
sep = " ";
fdirs += this->XCodeEscapePath(fdi->c_str());
this->AppendBuildSettingAttribute(target, "FRAMEWORK_SEARCH_PATHS",
fdirs.c_str(), configName);
// now add the link libraries
std::string linkLibs;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment