DAP: Add check that cmake 3.27 or higher

If CMake version is lower then 3.27
- Shows the warning in general message
- Starts CMake without debugging
- Stops debugging correctly

Change-Id: Ibb13555c20ae2961c0a3c2ef6ec0fcc25930dddc
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Artem Sokolovskii
2023-08-03 14:39:33 +02:00
parent 83d2ee56b7
commit 3ab2da691d
4 changed files with 21 additions and 4 deletions

View File

@@ -191,11 +191,15 @@ void CMakeBuildSystem::triggerParsing()
// active code model updater when the next one will be triggered.
m_cppCodeModelUpdater->cancel();
const CMakeTool *tool = m_parameters.cmakeTool();
CMakeTool::Version version = tool ? tool->version() : CMakeTool::Version();
const bool isDebuggable = (version.major == 3 && version.minor >= 27) || version.major > 3;
qCDebug(cmakeBuildSystemLog) << "Asking reader to parse";
m_reader.parse(reparseParameters & REPARSE_FORCE_CMAKE_RUN,
reparseParameters & REPARSE_FORCE_INITIAL_CONFIGURATION,
reparseParameters & REPARSE_FORCE_EXTRA_CONFIGURATION,
reparseParameters & REPARSE_DEBUG);
(reparseParameters & REPARSE_DEBUG) && isDebuggable);
}
void CMakeBuildSystem::requestDebugging()

View File

@@ -3,6 +3,8 @@
#include "cmakedapengine.h"
#include <coreplugin/messagemanager.h>
#include <debugger/debuggermainwindow.h>
#include <utils/temporarydirectory.h>
@@ -14,6 +16,7 @@
#include <QDebug>
#include <QLocalSocket>
#include <QLoggingCategory>
#include <QTimer>
using namespace Core;
using namespace Utils;
@@ -112,6 +115,16 @@ void CMakeDapEngine::setupEngine()
[this] { m_dataGenerator->start(); });
ProjectExplorer::ProjectTree::currentBuildSystem()->requestDebugging();
QTimer::singleShot(5000, this, [this] {
if (!m_dataGenerator->isRunning()) {
m_dataGenerator->kill();
MessageManager::writeDisrupting(
"CMake server is not running. Please check that your CMake is 3.27 or higher.");
return;
}
});
notifyEngineSetupOk();
}

View File

@@ -41,8 +41,8 @@
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/projecttree.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projecttree.h>
#include <QDateTime>
#include <QDebug>

View File

@@ -830,8 +830,8 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
});
connect(&m_startCmakeAction, &QAction::triggered, this, [] {
// ProjectTree::currentBuildSystem()->requestDebugging();
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::CMAKE_DEBUG_RUN_MODE, true);
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::CMAKE_DEBUG_RUN_MODE,
true);
});
connect(&m_debugWithoutDeployAction, &QAction::triggered, this, [] {