[cmake-developers] [PATCH] User may now specify toolset through CMake GUI

rcdailey.lists at gmail.com rcdailey.lists at gmail.com
Sun Feb 15 15:27:58 EST 2015


From: Robert Dailey <rcdailey at gmail.com>

The -T parameter to CMake may now be specified through QtDialog
(cmake-gui) via a new text field in the first-time configure
wizard (below the generator chooser).
---
 Source/QtDialog/CMakeSetupDialog.cxx |  1 +
 Source/QtDialog/FirstConfigure.cxx   | 18 +++++++++++++++++-
 Source/QtDialog/FirstConfigure.h     |  3 +++
 Source/QtDialog/QCMake.cxx           | 12 +++++++++++-
 Source/QtDialog/QCMake.h             |  5 +++++
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index b8077f2..dfe1e7c 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -705,6 +705,7 @@ bool CMakeSetupDialog::setupFirstConfigure()
     {
     dialog.saveToSettings();
     this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator());
+    this->CMakeThread->cmakeInstance()->setToolset(dialog.getToolset());
 
     QCMakeCacheModel* m = this->CacheValues->cacheModel();
 
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index 6de9f00..d22acd0 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -15,6 +15,12 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p)
   l->addWidget(new QLabel(tr("Specify the generator for this project")));
   this->GeneratorOptions = new QComboBox(this);
   l->addWidget(this->GeneratorOptions);
+
+  // Add the ability to specify toolset (-T parameter)
+  l->addWidget(new QLabel(tr("Optional toolset to use (-T parameter)")));
+  this->Toolset = new QLineEdit(this);
+  l->addWidget(this->Toolset);
+
   l->addSpacing(6);
 
   this->CompilerSetupOptions[0] = new QRadioButton(tr("Use default native compilers"), this);
@@ -59,7 +65,12 @@ void StartCompilerSetup::setCurrentGenerator(const QString& gen)
 
 QString StartCompilerSetup::getGenerator() const
 {
-  return this->GeneratorOptions->currentText();
+   return this->GeneratorOptions->currentText();
+};
+
+QString StartCompilerSetup::getToolset() const
+{
+   return this->Toolset->text();
 };
 
 bool StartCompilerSetup::defaultSetup() const
@@ -335,6 +346,11 @@ QString FirstConfigure::getGenerator() const
   return this->mStartCompilerSetupPage->getGenerator();
 }
 
+QString FirstConfigure::getToolset() const
+{
+  return this->mStartCompilerSetupPage->getToolset();
+}
+
 void FirstConfigure::loadFromSettings()
 {
   QSettings settings;
diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h
index be390b0..1848a9d 100644
--- a/Source/QtDialog/FirstConfigure.h
+++ b/Source/QtDialog/FirstConfigure.h
@@ -30,6 +30,7 @@ class StartCompilerSetup : public QWizardPage
     void setGenerators(const QStringList& gens);
     void setCurrentGenerator(const QString& gen);
     QString getGenerator() const;
+    QString getToolset() const;
 
     bool defaultSetup() const;
     bool compilerSetup() const;
@@ -46,6 +47,7 @@ class StartCompilerSetup : public QWizardPage
 
   protected:
     QComboBox* GeneratorOptions;
+    QLineEdit* Toolset;
     QRadioButton* CompilerSetupOptions[4];
 };
 
@@ -142,6 +144,7 @@ public:
 
   void setGenerators(const QStringList& gens);
   QString getGenerator() const;
+  QString getToolset() const;
 
   bool defaultSetup() const;
   bool compilerSetup() const;
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index b833648..b05b06d 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -125,7 +125,6 @@ void QCMake::setBinaryDirectory(const QString& _dir)
     }
 }
 
-
 void QCMake::setGenerator(const QString& gen)
 {
   if(this->Generator != gen)
@@ -135,6 +134,15 @@ void QCMake::setGenerator(const QString& gen)
     }
 }
 
+void QCMake::setToolset(const QString& toolset)
+{
+  if(this->Toolset != toolset)
+    {
+    this->Toolset = toolset;
+    emit this->toolsetChanged(this->Toolset);
+    }
+}
+
 void QCMake::configure()
 {
 #ifdef Q_OS_WIN
@@ -147,6 +155,8 @@ void QCMake::configure()
   this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toLocal8Bit().data());
   this->CMakeInstance->SetGlobalGenerator(
     this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data()));
+  this->CMakeInstance->SetGeneratorToolset(
+     this->Toolset.toLocal8Bit().data());
   this->CMakeInstance->LoadCache();
   this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
   this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index d910eb7..e25430d 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -73,6 +73,8 @@ public slots:
   void setBinaryDirectory(const QString& dir);
   /// set the desired generator to use
   void setGenerator(const QString& generator);
+  /// set the desired generator to use
+  void setToolset(const QString& toolset);
   /// do the configure step
   void configure();
   /// generate the files
@@ -130,6 +132,8 @@ signals:
   void errorMessage(const QString& msg);
   /// signal when debug output changes
   void debugOutputChanged(bool);
+  /// signal when the toolset changes
+  void toolsetChanged(const QString& toolset);
 
 protected:
   cmake* CMakeInstance;
@@ -147,6 +151,7 @@ protected:
   QString SourceDirectory;
   QString BinaryDirectory;
   QString Generator;
+  QString Toolset;
   QStringList AvailableGenerators;
   QString CMakeExecutable;
   QAtomicInt InterruptFlag;
-- 
2.1.0.msysgit.1



More information about the cmake-developers mailing list