summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-12-07 18:06:20 (GMT)
committerBrad King <brad.king@kitware.com>2012-12-07 20:14:19 (GMT)
commit2bc22bdaacfc0f0f91c229685dc5dbadd0267601 (patch)
tree8d38e3a3a2eaacd6d3fc064c0051fcff2c94de31
parent8521a9e9cad06922dc316f2c3a82f0263bbd7e87 (diff)
downloadCMake-2bc22bdaacfc0f0f91c229685dc5dbadd0267601.zip
CMake-2bc22bdaacfc0f0f91c229685dc5dbadd0267601.tar.gz
CMake-2bc22bdaacfc0f0f91c229685dc5dbadd0267601.tar.bz2
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.
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx36
1 files changed, 11 insertions, 25 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9bbeeaf..b2d325c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1997,15 +1997,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
dirs.Add(incpath.c_str());
}
}
- std::vector<std::string>& frameworks = target.GetFrameworks();
- if(frameworks.size())
+ 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))
{
- if(emitted.insert(*fmIt).second)
+ std::vector<std::string> const& fwDirs = cli->GetFrameworkPaths();
+ for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
+ fdi != fwDirs.end(); ++fdi)
{
- fdirs.Add(this->XCodeEscapePath(fmIt->c_str()).c_str());
+ if(emitted.insert(*fdi).second)
+ {
+ fdirs.Add(this->XCodeEscapePath(fdi->c_str()).c_str());
+ }
}
}
}
@@ -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());
- }
- if(!fdirs.empty())
- {
- this->AppendBuildSettingAttribute(target, "FRAMEWORK_SEARCH_PATHS",
- fdirs.c_str(), configName);
- }
- }
-
// now add the link libraries
{
std::string linkLibs;