Commit 4896bb41 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ProjectManagers: Detect Qt by kit for code-model update

Change-Id: Idf5f8233e4457bb22437d442732432acf0ce313e
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent b192d18e
......@@ -53,6 +53,8 @@
#include <cpptools/cppmodelmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h>
#include <utils/filesystemwatcher.h>
......@@ -408,6 +410,16 @@ void AutotoolsProject::updateCppCodeModel()
CppTools::ProjectInfo pInfo(this);
CppTools::ProjectPartBuilder ppBuilder(pInfo);
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
if (QtSupport::BaseQtVersion *qtVersion =
QtSupport::QtKitInformation::qtVersion(activeTarget()->kit())) {
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
activeQtVersion = CppTools::ProjectPart::Qt4;
else
activeQtVersion = CppTools::ProjectPart::Qt5;
}
ppBuilder.setQtVersion(activeQtVersion);
const QStringList cflags = m_makefileParserThread->cflags();
QStringList cxxflags = m_makefileParserThread->cxxflags();
if (cxxflags.isEmpty())
......
......@@ -317,6 +317,16 @@ bool CMakeProject::parseCMakeLists()
CppTools::ProjectInfo pinfo(this);
CppTools::ProjectPartBuilder ppBuilder(pinfo);
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k)) {
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
activeQtVersion = CppTools::ProjectPart::Qt4;
else
activeQtVersion = CppTools::ProjectPart::Qt5;
}
ppBuilder.setQtVersion(activeQtVersion);
foreach (const CMakeBuildTarget &cbt, m_buildTargets) {
// This explicitly adds -I. to the include paths
QStringList includePaths = cbt.includeFiles;
......
......@@ -46,7 +46,9 @@
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
......@@ -349,6 +351,17 @@ void GenericProject::refreshCppCodeModel()
CppTools::ProjectInfo pInfo(this);
CppTools::ProjectPartBuilder ppBuilder(pInfo);
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
if (QtSupport::BaseQtVersion *qtVersion =
QtSupport::QtKitInformation::qtVersion(activeTarget()->kit())) {
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
activeQtVersion = CppTools::ProjectPart::Qt4;
else
activeQtVersion = CppTools::ProjectPart::Qt5;
}
ppBuilder.setQtVersion(activeQtVersion);
ppBuilder.setIncludePaths(projectIncludePaths());
ppBuilder.setConfigFileName(configFileName());
ppBuilder.setCxxFlags(QStringList() << QLatin1String("-std=c++11"));
......
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