Commit 528ec741 authored by Erik Verbruggen's avatar Erik Verbruggen

Add private frameworks when a framework is added.

Task-number: QTCREATORBUG-1102
Reviewed-by: Roberto Raggi
parent 375dd56e
......@@ -219,7 +219,41 @@ void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
}
void CppPreprocessor::setFrameworkPaths(const QStringList &frameworkPaths)
{ m_frameworkPaths = frameworkPaths; }
{
m_frameworkPaths.clear();
foreach (const QString &frameworkPath, frameworkPaths) {
addFrameworkPath(frameworkPath);
}
}
// Add the given framework path, and expand private frameworks.
//
// Example:
// <framework-path>/ApplicationServices.framework
// has private frameworks in:
// <framework-path>/ApplicationServices.framework/Frameworks
// if the "Frameworks" folder exists inside the top level framework.
void CppPreprocessor::addFrameworkPath(const QString &frameworkPath)
{
// The algorithm below is a bit too eager, but that's because we're not getting
// in the frameworks we're linking against. If we would have that, then we could
// add only those private frameworks.
if (!m_frameworkPaths.contains(frameworkPath)) {
m_frameworkPaths.append(frameworkPath);
}
const QDir frameworkDir(frameworkPath);
const QStringList filter = QStringList() << QLatin1String("*.framework");
foreach (const QFileInfo &framework, frameworkDir.entryInfoList(filter)) {
if (!framework.isDir())
continue;
const QFileInfo privateFrameworks(framework.absoluteFilePath(), QLatin1String("Frameworks"));
if (privateFrameworks.exists() && privateFrameworks.isDir()) {
addFrameworkPath(privateFrameworks.absoluteFilePath());
}
}
}
void CppPreprocessor::setProjectFiles(const QStringList &files)
{ m_projectFiles = files; }
......
......@@ -252,6 +252,7 @@ public:
void setWorkingCopy(const CppModelManagerInterface::WorkingCopy &workingCopy);
void setIncludePaths(const QStringList &includePaths);
void setFrameworkPaths(const QStringList &frameworkPaths);
void addFrameworkPath(const QString &frameworkPath);
void setProjectFiles(const QStringList &files);
void setTodo(const QStringList &files);
......
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