diff options
author | Sergey Shambir <sergey.shambir.auto@gmail.com> | 2013-04-28 16:23:01 +0400 |
---|---|---|
committer | Sergey Shambir <sergey.shambir.auto@gmail.com> | 2013-05-02 12:59:44 +0200 |
commit | 2d8a9674b42dea871efaa1bca5b96cbaeec4b060 (patch) | |
tree | 93585527312140e042b6bfdf471d1fb4c152d14a /src/plugins/cmakeprojectmanager/cmakeproject.cpp | |
parent | 00885ca9a560536dcfa7537af4d00cf397ec0c18 (diff) | |
download | qt-creator-2d8a9674b42dea871efaa1bca5b96cbaeec4b060.tar.gz |
CMake: simplified C++ codemodel interaction.
Now it uses ProjectPart::evaluateToolchain() to read toolchain info with
given compiler flags, so it saves old behavior and also reads C version
and C++ extensions.
Removed check that model doesn't need to be updated, since check didn't
account ProjectPart enums.
Change-Id: I6dbebeecdb162ec5b885f9f1846756b586c22b23
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakeproject.cpp')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeproject.cpp | 68 |
1 files changed, 24 insertions, 44 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 438c9c9bb5..87efca9c1c 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -314,11 +314,6 @@ bool CMakeProject::parseCMakeLists() return true; } - QStringList allIncludePaths; - // This explicitly adds -I. to the include paths - allIncludePaths.append(projectDirectory()); - allIncludePaths.append(cbpparser.includeFiles()); - QStringList cxxflags; bool found = false; foreach (const CMakeBuildTarget &buildTarget, m_buildTargets) { @@ -374,51 +369,36 @@ bool CMakeProject::parseCMakeLists() } } - QByteArray allDefines; - allDefines.append(tc->predefinedMacros(cxxflags)); - allDefines.append(cbpparser.defines()); - - QStringList allFrameworkPaths; - QList<ProjectExplorer::HeaderPath> allHeaderPaths; - allHeaderPaths = tc->systemHeaderPaths(cxxflags, SysRootKitInformation::sysRoot(k)); - foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) { - if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath) - allFrameworkPaths.append(headerPath.path()); - else - allIncludePaths.append(headerPath.path()); - } - CppTools::CppModelManagerInterface *modelmanager = CppTools::CppModelManagerInterface::instance(); if (modelmanager) { CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this); - if (pinfo.includePaths() != allIncludePaths - || pinfo.sourceFiles() != m_files - || pinfo.defines() != allDefines - || pinfo.frameworkPaths() != allFrameworkPaths) { - pinfo.clearProjectParts(); - CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart); - part->includePaths = allIncludePaths; - CppTools::ProjectFileAdder adder(part->files); - foreach (const QString &file, m_files) - adder.maybeAdd(file); - part->defines = allDefines; - part->frameworkPaths = allFrameworkPaths; - part->cVersion = CppTools::ProjectPart::C99; - if (tc) - part->cxxVersion = (tc->compilerFlags(cxxflags) | ToolChain::StandardCxx11) - ? CppTools::ProjectPart::CXX11 - : CppTools::ProjectPart::CXX98; - else - part->cxxVersion = CppTools::ProjectPart::CXX11; - pinfo.appendProjectPart(part); - modelmanager->updateProjectInfo(pinfo); - m_codeModelFuture.cancel(); - m_codeModelFuture = modelmanager->updateSourceFiles(m_files); + pinfo.clearProjectParts(); - setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty()); - } + CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart); + + part->evaluateToolchain(tc, + cxxflags, + cxxflags, + SysRootKitInformation::sysRoot(k)); + + // This explicitly adds -I. to the include paths + part->includePaths += projectDirectory(); + part->includePaths += cbpparser.includeFiles(); + part->defines += cbpparser.defines(); + + CppTools::ProjectFileAdder adder(part->files); + foreach (const QString &file, m_files) + adder.maybeAdd(file); + + pinfo.appendProjectPart(part); + modelmanager->updateProjectInfo(pinfo); + m_codeModelFuture.cancel(); + m_codeModelFuture = modelmanager->updateSourceFiles(m_files); + + setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty()); } + emit buildTargetsChanged(); emit fileListChanged(); |