CMake: Delay initialization of CMakeTools

Do not run cmake 5 times during startup. Delay that as far as possible.

Also add a supportedGenerators() method while visiting the code anyway.

Fix up and simplify the other cmake help output parsers.

Change-Id: I6622d552ffe559bf099b4b278618676a045e350e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-01-22 13:50:58 +01:00
parent acdfb09687
commit fa17e27b7f
5 changed files with 210 additions and 266 deletions

View File

@@ -131,7 +131,7 @@ static void readAndDeleteLegacyCMakeSettings ()
if (exec.toFileInfo().isExecutable()) {
CMakeTool *item = CMakeToolManager::findByCommand(exec);
if (!item) {
item = new CMakeTool(CMakeTool::ManualDetection);
item = new CMakeTool(CMakeTool::ManualDetection, CMakeTool::createId());
item->setCMakeExecutable(exec);
item->setDisplayName(CMakeToolManager::tr("CMake at %1").arg(item->cmakeExecutable().toUserOutput()));
@@ -182,7 +182,7 @@ static QList<CMakeTool *> autoDetectCMakeTools()
QList<CMakeTool *> found;
foreach (const FileName &command, suspects) {
auto item = new CMakeTool(CMakeTool::AutoDetection);
auto item = new CMakeTool(CMakeTool::AutoDetection, CMakeTool::createId());
item->setCMakeExecutable(command);
item->setDisplayName(CMakeToolManager::tr("System CMake at %1").arg(command.toUserOutput()));
@@ -247,7 +247,7 @@ Id CMakeToolManager::registerOrFindCMakeTool(const FileName &command)
if (cmake)
return cmake->id();
cmake = new CMakeTool(CMakeTool::ManualDetection);
cmake = new CMakeTool(CMakeTool::ManualDetection, CMakeTool::createId());
cmake->setCMakeExecutable(command);
cmake->setDisplayName(tr("CMake at %1").arg(command.toUserOutput()));