CMake: add Ninja support

The cmake wizard proposes also ninja if ninja support is available

Ninja must be in PATH, but it is only called once, so it doesn't hurt.

Task-number: QTCREATORBUG-7720
Reviewed-by: Daniel Teske <daniel.teske@digia.com>

Change-Id: If3c9c7ae55e6990fa16b031fc2998a8d8d9ed17a
Reviewed-by: Peter Kümmel <syntheticpp@gmx.net>
Reviewed-by: Yuchen Deng <loaden@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Peter Kümmel
2012-10-02 17:46:12 +02:00
committed by Daniel Teske
parent bec84f09aa
commit 264313ec90
9 changed files with 212 additions and 38 deletions

View File

@@ -123,7 +123,7 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
cmakeProject->projectDirectory(),
bc->buildDirectory(),
CMakeOpenProjectWizard::WantToUpdate,
bc->environment());
bc);
if (copw.exec() == QDialog::Accepted)
cmakeProject->parseCMakeLists();
}
@@ -160,6 +160,11 @@ bool CMakeManager::hasCodeBlocksMsvcGenerator() const
return m_settingsPage->hasCodeBlocksMsvcGenerator();
}
bool CMakeManager::hasCodeBlocksNinjaGenerator() const
{
return m_settingsPage->hasCodeBlocksNinjaGenerator();
}
// need to refactor this out
// we probably want the process instead of this function
// cmakeproject then could even run the cmake process in the background, adding the files afterwards
@@ -253,6 +258,8 @@ CMakeSettingsPage::CMakeSettingsPage()
m_pathCmake.process = 0;
m_userCmake.hasCodeBlocksMsvcGenerator = false;
m_pathCmake.hasCodeBlocksMsvcGenerator = false;
m_userCmake.hasCodeBlocksNinjaGenerator = false;
m_pathCmake.hasCodeBlocksNinjaGenerator = false;
QSettings *settings = Core::ICore::settings();
settings->beginGroup(QLatin1String("CMakeSettings"));
m_userCmake.executable = settings->value(QLatin1String("cmakeExecutable")).toString();
@@ -297,6 +304,7 @@ void CMakeSettingsPage::cmakeFinished(CMakeValidator *cmakeValidator) const
versionRegexp.indexIn(response);
//m_supportsQtCreator = response.contains(QLatin1String("QtCreator"));
cmakeValidator->hasCodeBlocksNinjaGenerator = response.contains(QLatin1String("CodeBlocks - Ninja"));
cmakeValidator->hasCodeBlocksMsvcGenerator = response.contains(QLatin1String("CodeBlocks - NMake Makefiles"));
cmakeValidator->version = versionRegexp.cap(1);
if (!(versionRegexp.capturedTexts().size() > 3))
@@ -426,3 +434,13 @@ bool CMakeSettingsPage::hasCodeBlocksMsvcGenerator() const
else
return m_pathCmake.hasCodeBlocksMsvcGenerator;
}
bool CMakeSettingsPage::hasCodeBlocksNinjaGenerator() const
{
if (!isCMakeExecutableValid())
return false;
if (m_userCmake.state == CMakeValidator::VALID)
return m_userCmake.hasCodeBlocksNinjaGenerator;
else
return m_pathCmake.hasCodeBlocksNinjaGenerator;
}