forked from qt-creator/qt-creator
cmake: Show errors for unsupported CMake versions
Show an error icon in the CMake settings, and instead running CMake with unsupported parameters show an error in the Issues pane. Arguably it should not be possible to select an unsupported CMake version in the kit settings at all (neither manually nor automatically when setting up kits), but this is the less intrusive change for now. Fixes: QTCREATORBUG-24553 Change-Id: I32caa2ce93d28cbd9db90e2004d60da93d32c68c Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -390,6 +390,12 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa
|
||||
tr("The kit needs to define a CMake tool to parse this project.")));
|
||||
return;
|
||||
}
|
||||
if (!parameters.cmakeTool()->hasFileApi()) {
|
||||
TaskHub::addTask(BuildSystemTask(Task::Error,
|
||||
CMakeKitAspect::msgUnsupportedVersion(
|
||||
parameters.cmakeTool()->version().fullVersion)));
|
||||
return;
|
||||
}
|
||||
QTC_ASSERT(parameters.isValid(), return );
|
||||
|
||||
m_parameters = parameters;
|
||||
|
@@ -255,10 +255,7 @@ Tasks CMakeKitAspect::validate(const Kit *k) const
|
||||
if (tool) {
|
||||
CMakeTool::Version version = tool->version();
|
||||
if (version.major < 3 || (version.major == 3 && version.minor < 14)) {
|
||||
result << BuildSystemTask(Task::Warning,
|
||||
tr("CMake version %1 is unsupported. Please update to "
|
||||
"version 3.14 (with file-api) or later.")
|
||||
.arg(QString::fromUtf8(version.fullVersion)));
|
||||
result << BuildSystemTask(Task::Warning, msgUnsupportedVersion(version.fullVersion));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -305,6 +302,13 @@ QSet<Utils::Id> CMakeKitAspect::availableFeatures(const Kit *k) const
|
||||
return {};
|
||||
}
|
||||
|
||||
QString CMakeKitAspect::msgUnsupportedVersion(const QByteArray &versionString)
|
||||
{
|
||||
return tr("CMake version %1 is unsupported. Please update to "
|
||||
"version 3.14 (with file-api) or later.")
|
||||
.arg(QString::fromUtf8(versionString));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeGeneratorKitAspect:
|
||||
// --------------------------------------------------------------------
|
||||
|
@@ -56,6 +56,8 @@ public:
|
||||
void addToMacroExpander(ProjectExplorer::Kit *k, Utils::MacroExpander *expander) const final;
|
||||
|
||||
QSet<Utils::Id> availableFeatures(const ProjectExplorer::Kit *k) const final;
|
||||
|
||||
static QString msgUnsupportedVersion(const QByteArray &versionString);
|
||||
};
|
||||
|
||||
class CMAKE_EXPORT CMakeGeneratorKitAspect : public ProjectExplorer::KitAspect
|
||||
|
@@ -204,7 +204,8 @@ public:
|
||||
if (column != 0)
|
||||
return QVariant();
|
||||
|
||||
const bool hasError = !m_pathExists || !m_pathIsFile || !m_pathIsExecutable;
|
||||
const bool hasError = !m_isSupported || !m_pathExists || !m_pathIsFile
|
||||
|| !m_pathIsExecutable;
|
||||
if (hasError)
|
||||
return Utils::Icons::CRITICAL.icon();
|
||||
return QVariant();
|
||||
|
Reference in New Issue
Block a user