forked from qt-creator/qt-creator
CMake: Register a feature for CMake-capable kits
This in theory enables to fix QTCREATORBUG-16204, but for that the wizard needs logic to adapt the required features for the listed kits. That is still missing. Task-number: QTCREATORBUG-16204 Change-Id: Ia01c11bb8c8567a9fc65b06912d6836b70a0195c Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "cmakekitinformation.h"
|
||||
#include "cmakekitconfigwidget.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmaketoolmanager.h"
|
||||
#include "cmaketool.h"
|
||||
|
||||
@@ -113,7 +114,7 @@ QList<Task> CMakeKitInformation::validate(const Kit *k) const
|
||||
if (version.major < 3) {
|
||||
result << Task(Task::Warning, tr("CMake version %1 is unsupported. Please update to "
|
||||
"version 3.0 or later.").arg(QString::fromUtf8(version.fullVersion)),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -149,7 +150,14 @@ void CMakeKitInformation::addToMacroExpander(Kit *k, Utils::MacroExpander *expan
|
||||
[this, k]() -> QString {
|
||||
CMakeTool *tool = CMakeKitInformation::cmakeTool(k);
|
||||
return tool ? tool->cmakeExecutable().toString() : QString();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
QSet<Core::Id> CMakeKitInformation::availableFeatures(const Kit *k) const
|
||||
{
|
||||
if (cmakeTool(k))
|
||||
return { CMakeProjectManager::Constants::CMAKE_FEATURE_ID };
|
||||
return {};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -316,7 +324,7 @@ QVariant CMakeGeneratorKitInformation::defaultValue(const Kit *k) const
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
// *sigh* Windows with its zoo of incompatible stuff again...
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(k, Constants::CXX_LANGUAGE_ID);
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
if (tc && tc->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID) {
|
||||
it = std::find_if(known.constBegin(), known.constEnd(),
|
||||
[extraGenerator](const CMakeTool::Generator &g) {
|
||||
@@ -353,7 +361,7 @@ QList<Task> CMakeGeneratorKitInformation::validate(const Kit *k) const
|
||||
if (tool) {
|
||||
if (!tool->isValid()) {
|
||||
result << Task(Task::Warning, tr("CMake Tool is unconfigured, CMake generator will be ignored."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
} else {
|
||||
QList<CMakeTool::Generator> known = tool->supportedGenerators();
|
||||
auto it = std::find_if(known.constBegin(), known.constEnd(), [info](const CMakeTool::Generator &g) {
|
||||
@@ -361,22 +369,22 @@ QList<Task> CMakeGeneratorKitInformation::validate(const Kit *k) const
|
||||
});
|
||||
if (it == known.constEnd()) {
|
||||
result << Task(Task::Warning, tr("CMake Tool does not support the configured generator."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
} else {
|
||||
if (!it->supportsPlatform && !info.platform.isEmpty()) {
|
||||
result << Task(Task::Warning, tr("Platform is not supported by the selected CMake generator."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
if (!it->supportsToolset && !info.toolset.isEmpty()) {
|
||||
result << Task(Task::Warning, tr("Toolset is not supported by the selected CMake generator."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
}
|
||||
if (!tool->hasServerMode() && info.extraGenerator != "CodeBlocks") {
|
||||
result << Task(Task::Warning, tr("The selected CMake binary has no server-mode and the CMake "
|
||||
"generator does not generate a CodeBlocks file. "
|
||||
"Qt Creator will not be able to parse CMake projects."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -536,8 +544,8 @@ QVariant CMakeConfigurationKitInformation::defaultValue(const Kit *k) const
|
||||
QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const
|
||||
{
|
||||
const QtSupport::BaseQtVersion *const version = QtSupport::QtKitInformation::qtVersion(k);
|
||||
const ToolChain *const tcC = ToolChainKitInformation::toolChain(k, Constants::C_LANGUAGE_ID);
|
||||
const ToolChain *const tcCxx = ToolChainKitInformation::toolChain(k, Constants::CXX_LANGUAGE_ID);
|
||||
const ToolChain *const tcC = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::C_LANGUAGE_ID);
|
||||
const ToolChain *const tcCxx = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
const CMakeConfig config = configuration(k);
|
||||
|
||||
const bool isQt4 = version && version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0);
|
||||
@@ -565,25 +573,25 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const
|
||||
if (version && version->isValid() && isQt4) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has no path to qmake binary set, "
|
||||
"even though the kit has a valid Qt version."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
} else {
|
||||
if (!version || !version->isValid()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has a path to a qmake binary set, "
|
||||
"even though the kit has no valid Qt version."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
} else if (qmakePath != version->qmakeCommand() && isQt4) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has a path to a qmake binary set "
|
||||
"that does not match the qmake binary path "
|
||||
"configured in the Qt version."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
}
|
||||
if (version && !qtInstallDirs.contains(version->qmakeProperty("QT_INSTALL_PREFIX")) && !isQt4) {
|
||||
if (version->isValid()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has no CMAKE_PREFIX_PATH set "
|
||||
"that points to the kit Qt version."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,18 +600,18 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const
|
||||
if (tcC && tcC->isValid()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has no path to a C compiler set, "
|
||||
"even though the kit has a valid tool chain."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
} else {
|
||||
if (!tcC || !tcC->isValid()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has a path to a C compiler set, "
|
||||
"even though the kit has no valid tool chain."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
} else if (tcCPath != tcC->compilerCommand()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has a path to a C compiler set "
|
||||
"that does not match the compiler path "
|
||||
"configured in the tool chain of the kit."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,18 +619,18 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const
|
||||
if (tcCxx && tcCxx->isValid()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has no path to a C++ compiler set, "
|
||||
"even though the kit has a valid tool chain."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
} else {
|
||||
if (!tcCxx || !tcCxx->isValid()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has a path to a C++ compiler set, "
|
||||
"even though the kit has no valid tool chain."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
} else if (tcCxxPath != tcCxx->compilerCommand()) {
|
||||
result << Task(Task::Warning, tr("CMake configuration has a path to a C++ compiler set "
|
||||
"that does not match the compiler path "
|
||||
"configured in the tool chain of the kit."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user