diff options
author | Julien Jomier <julien.jomier@kitware.com> | 2019-01-04 11:41:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-18 17:41:35 (GMT) |
commit | 48ec0bc1401b99e5a2d07392fb98f96d5fec9e50 (patch) | |
tree | 81d9548d57db659099cade2ab918becb06b9c84d /Source/QtDialog/QCMake.cxx | |
parent | 8bba458ea5d6b792e165560d79efd8d8356f4329 (diff) | |
download | CMake-48ec0bc1401b99e5a2d07392fb98f96d5fec9e50.zip CMake-48ec0bc1401b99e5a2d07392fb98f96d5fec9e50.tar.gz CMake-48ec0bc1401b99e5a2d07392fb98f96d5fec9e50.tar.bz2 |
cmake-gui: Add field for generator platform selection
Extend the "first configure" dialog with a field for the user to select
a value for `CMAKE_GENERATOR_PLATFORM`.
Fixes: #17343
Diffstat (limited to 'Source/QtDialog/QCMake.cxx')
-rw-r--r-- | Source/QtDialog/QCMake.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 9a6784e..2eecce6 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -35,7 +35,8 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this); std::vector<cmake::GeneratorInfo> generators; - this->CMakeInstance->GetRegisteredGenerators(generators); + this->CMakeInstance->GetRegisteredGenerators( + generators, /*includeNamesWithPlatform=*/false); std::vector<cmake::GeneratorInfo>::const_iterator it; for (it = generators.begin(); it != generators.end(); ++it) { @@ -74,6 +75,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) cmState* state = this->CMakeInstance->GetState(); this->setGenerator(QString()); this->setToolset(QString()); + this->setPlatform(QString()); if (!this->CMakeInstance->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) { QDir testDir(this->BinaryDirectory); @@ -102,6 +104,12 @@ void QCMake::setBinaryDirectory(const QString& _dir) this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } + const char* platform = + state->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM"); + if (platform) { + this->setPlatform(QString::fromLocal8Bit(platform)); + } + const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET"); if (toolset) { this->setToolset(QString::fromLocal8Bit(toolset)); @@ -119,6 +127,14 @@ void QCMake::setGenerator(const QString& gen) } } +void QCMake::setPlatform(const QString& platform) +{ + if (this->Platform != platform) { + this->Platform = platform; + emit this->platformChanged(this->Platform); + } +} + void QCMake::setToolset(const QString& toolset) { if (this->Toolset != toolset) { @@ -140,7 +156,8 @@ void QCMake::configure() this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->CreateGlobalGenerator( this->Generator.toLocal8Bit().data())); - this->CMakeInstance->SetGeneratorPlatform(""); + this->CMakeInstance->SetGeneratorPlatform( + this->Platform.toLocal8Bit().data()); this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data()); this->CMakeInstance->LoadCache(); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); |