diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-04-03 14:31:32 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-04-04 13:27:30 +0000 |
commit | 8b956868bb4e802448f85f28fff06763df5e1086 (patch) | |
tree | c78194596d7926cb05f4fe08734eae6fc0822119 | |
parent | f8688a478e0dfb2565603d36898df288c0639a0b (diff) |
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>
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakekitinformation.cpp | 48 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakekitinformation.h | 2 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeprojectconstants.h | 3 |
3 files changed, 33 insertions, 20 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 25f3e2d411f..9e5962d3aef 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -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)); } } diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.h b/src/plugins/cmakeprojectmanager/cmakekitinformation.h index 50152dcdae7..87f9de0b67e 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.h +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.h @@ -55,6 +55,8 @@ public: ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const final; void addToMacroExpander(ProjectExplorer::Kit *k, Utils::MacroExpander *expander) const final; + + QSet<Core::Id> availableFeatures(const ProjectExplorer::Kit *k) const final; }; class CMAKE_EXPORT CMakeGeneratorKitInformation : public ProjectExplorer::KitInformation diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index c84e3f08dd8..2727612002f 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -64,5 +64,8 @@ const char BUILD_TARGET_CONTEXTMENU[] = "CMake.BuildTargetContextMenu"; // Build Step const char CMAKE_BUILD_STEP_ID[] = "CMakeProjectManager.MakeStep"; +// Features +const char CMAKE_FEATURE_ID[] = "CMakeProjectManager.Wizard.FeatureCMake"; + } // namespace Constants } // namespace CMakeProjectManager |