aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
diff options
context:
space:
mode:
authorBenjamin Zeller <benjamin.zeller@canonical.com>2015-03-04 13:32:31 +0100
committerBenjamin Zeller <benjamin.zeller@canonical.com>2015-03-09 16:15:28 +0000
commitbebcf69ce92442652bfa270de20ecef321ec0613 (patch)
treeed0dcb049e7b040298f094d3f12bfc918dfc769f /src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
parent3cd0463f3235406262d1e220c239f6e3b70bf65b (diff)
CMakeProjectManager: Provide way for plugins to autodetect cmake tools
This patch adds support for plugins to register a callback/lambda to autodetect CMakeTools that would not be found by the default auto- detection function. Without this feature the CMakeToolManager would drop autodetected CMakeTools otherwise on every start. Change-Id: I23b146e5b9acc60018ac87ea4b6cc7573fa0dd30 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
index e3043db252..b65febaec0 100644
--- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
@@ -31,6 +31,7 @@
#include "cmaketoolmanager.h"
#include <coreplugin/icore.h>
+#include <projectexplorer/toolchainmanager.h>
#include <utils/persistentsettings.h>
#include <utils/qtcassert.h>
#include <utils/environment.h>
@@ -42,6 +43,7 @@
using namespace Core;
using namespace Utils;
+using namespace ProjectExplorer;
namespace CMakeProjectManager {
@@ -65,6 +67,7 @@ public:
Id m_defaultCMake;
QList<CMakeTool *> m_cmakeTools;
PersistentSettingsWriter *m_writer;
+ QList<CMakeToolManager::AutodetectionHelper> m_autoDetectionHelpers;
};
static CMakeToolManagerPrivate *d = 0;
@@ -186,6 +189,10 @@ static QList<CMakeTool *> autoDetectCMakeTools()
found.append(item);
}
+ //execute custom helpers if available
+ foreach (CMakeToolManager::AutodetectionHelper source, d->m_autoDetectionHelpers)
+ found.append(source());
+
return found;
}
@@ -363,8 +370,8 @@ void CMakeToolManager::restoreCMakeTools()
}
//filter out the tools that are already known
- for (int i = autoDetected.size() - 1; i >= 0; i--) {
- CMakeTool *currTool = autoDetected.takeAt(i);
+ while (autoDetected.size()) {
+ CMakeTool *currTool = autoDetected.takeFirst();
if (Utils::anyOf(toolsToRegister,
Utils::equal(&CMakeTool::cmakeExecutable, currTool->cmakeExecutable())))
delete currTool;
@@ -390,6 +397,11 @@ void CMakeToolManager::restoreCMakeTools()
readAndDeleteLegacyCMakeSettings();
}
+void CMakeToolManager::registerAutodetectionHelper(CMakeToolManager::AutodetectionHelper helper)
+{
+ d->m_autoDetectionHelpers.append(helper);
+}
+
void CMakeToolManager::notifyAboutUpdate(CMakeTool *tool)
{
if (!tool || !d->m_cmakeTools.contains(tool))