forked from qt-creator/qt-creator
Fix a crash with cmake and no toolchains configured
Task-number: QTCREATORBUG-6252 Change-Id: I8b7237c23cd70fe8dd20724ffb3ebdef18f5bf13 Reviewed-on: http://codereview.qt-project.org/6320 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
This commit is contained in:
@@ -288,7 +288,9 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
allIncludePaths.append(cbpparser.includeFiles());
|
allIncludePaths.append(cbpparser.includeFiles());
|
||||||
|
|
||||||
QStringList allFrameworkPaths;
|
QStringList allFrameworkPaths;
|
||||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
|
QList<ProjectExplorer::HeaderPath> allHeaderPaths;
|
||||||
|
if (activeBC->toolChain())
|
||||||
|
allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
|
||||||
foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) {
|
foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) {
|
||||||
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||||
allFrameworkPaths.append(headerPath.path());
|
allFrameworkPaths.append(headerPath.path());
|
||||||
@@ -302,12 +304,12 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
if (pinfo.includePaths != allIncludePaths
|
if (pinfo.includePaths != allIncludePaths
|
||||||
|| pinfo.sourceFiles != m_files
|
|| pinfo.sourceFiles != m_files
|
||||||
|| pinfo.defines != activeBC->toolChain()->predefinedMacros()
|
|| pinfo.defines != (activeBC->toolChain() ? activeBC->toolChain()->predefinedMacros() : QByteArray())
|
||||||
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
||||||
pinfo.includePaths = allIncludePaths;
|
pinfo.includePaths = allIncludePaths;
|
||||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||||
pinfo.sourceFiles = m_files;
|
pinfo.sourceFiles = m_files;
|
||||||
pinfo.defines = activeBC->toolChain()->predefinedMacros(); // TODO this is to simplistic
|
pinfo.defines = (activeBC->toolChain() ? activeBC->toolChain()->predefinedMacros() : QByteArray()); // TODO this is to simplistic
|
||||||
pinfo.frameworkPaths = allFrameworkPaths;
|
pinfo.frameworkPaths = allFrameworkPaths;
|
||||||
modelmanager->updateProjectInfo(pinfo);
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
m_codeModelFuture.cancel();
|
m_codeModelFuture.cancel();
|
||||||
|
|||||||
@@ -142,7 +142,10 @@ bool MakeStep::init()
|
|||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
pp->setEnvironment(bc->environment());
|
pp->setEnvironment(bc->environment());
|
||||||
pp->setWorkingDirectory(bc->buildDirectory());
|
pp->setWorkingDirectory(bc->buildDirectory());
|
||||||
pp->setCommand(bc->toolChain()->makeCommand());
|
if (bc->toolChain())
|
||||||
|
pp->setCommand(bc->toolChain()->makeCommand());
|
||||||
|
else
|
||||||
|
pp->setCommand(QLatin1String("make"));
|
||||||
pp->setArguments(arguments);
|
pp->setArguments(arguments);
|
||||||
|
|
||||||
setOutputParser(new ProjectExplorer::GnuMakeParser());
|
setOutputParser(new ProjectExplorer::GnuMakeParser());
|
||||||
|
|||||||
Reference in New Issue
Block a user