forked from qt-creator/qt-creator
CMakePM: Do not crash with CMake presets and no CMake tool
If no CMake is found, show an error message (reusing an existing translated string). Fixes: QTCREATORBUG-30505 Change-Id: I6e3037ee97dfba21791191483fffab769a451125 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
committed by
Alessandro Portale
parent
90f66d63fa
commit
52c39d007f
@@ -17,6 +17,7 @@
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
|
||||
#include <qtsupport/qtkitaspect.h>
|
||||
@@ -723,8 +724,14 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
|
||||
if (!configurePreset.cmakeExecutable) {
|
||||
const CMakeTool *cmakeTool = CMakeToolManager::defaultCMakeTool();
|
||||
if (cmakeTool)
|
||||
if (cmakeTool) {
|
||||
configurePreset.cmakeExecutable = cmakeTool->cmakeExecutable().toString();
|
||||
} else {
|
||||
configurePreset.cmakeExecutable = QString();
|
||||
TaskHub::addTask(
|
||||
BuildSystemTask(Task::TaskType::Error, Tr::tr("<No CMake Tool available>")));
|
||||
TaskHub::requestPopup();
|
||||
}
|
||||
} else {
|
||||
QString cmakeExecutable = configurePreset.cmakeExecutable.value();
|
||||
CMakePresets::Macros::expand(configurePreset, env, projectDirectory(), cmakeExecutable);
|
||||
|
||||
Reference in New Issue
Block a user