diff options
-rw-r--r-- | src/plugins/autotoolsprojectmanager/autotoolsproject.cpp | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index e4321cdd95..25ea5b47a6 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -408,55 +408,30 @@ void AutotoolsProject::updateCppCodeModel() { CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance(); - if (!modelManager) return; - QStringList allIncludePaths = m_makefileParserThread->includePaths(); - QStringList allFrameworkPaths; - QByteArray macros; + const QStringList cxxflags; // FIXME: Autotools should be able to do better than this! - QStringList cxxflags; // FIXME: Autotools should be able to do better than this! + CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this); + pinfo.clearProjectParts(); + CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart); if (activeTarget()) { ProjectExplorer::Kit *k = activeTarget()->kit(); ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); - if (tc) { - const QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths(cxxflags, - SysRootKitInformation::sysRoot(k)); - foreach (const HeaderPath &headerPath, allHeaderPaths) { - if (headerPath.kind() == HeaderPath::FrameworkHeaderPath) - allFrameworkPaths.append(headerPath.path()); - else - allIncludePaths.append(headerPath.path()); - } - macros = tc->predefinedMacros(cxxflags); - macros += '\n'; - } + part->evaluateToolchain(tc, cxxflags, cxxflags, + SysRootKitInformation::sysRoot(k)); } - CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this); + foreach (const QString &file, m_files) + part->files << CppTools::ProjectFile(file, CppTools::ProjectFile::CXXSource); - const bool update = (pinfo.includePaths() != allIncludePaths) - || (pinfo.sourceFiles() != m_files) - || (pinfo.defines() != macros) - || (pinfo.frameworkPaths() != allFrameworkPaths); - if (update) { - pinfo.clearProjectParts(); - CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart); - part->includePaths = allIncludePaths; - foreach (const QString &file, m_files) - part->files << CppTools::ProjectFile(file, CppTools::ProjectFile::CXXSource); - - part->defines = macros; - part->frameworkPaths = allFrameworkPaths; - part->cVersion = CppTools::ProjectPart::C99; - part->cxxVersion = CppTools::ProjectPart::CXX11; - pinfo.appendProjectPart(part); - - modelManager->updateProjectInfo(pinfo); - modelManager->updateSourceFiles(m_files); - - setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty()); - } + part->includePaths += m_makefileParserThread->includePaths(); + pinfo.appendProjectPart(part); + + modelManager->updateProjectInfo(pinfo); + modelManager->updateSourceFiles(m_files); + + setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty()); } |