diff options
Diffstat (limited to 'Source/QtDialog/QCMake.cxx')
-rw-r--r-- | Source/QtDialog/QCMake.cxx | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 3b5dc04..eaf50f2 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "QCMake.h" +#include <cm/memory> + #include <QCoreApplication> #include <QDir> @@ -35,7 +37,8 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetStderrCallback( [this](std::string const& msg) { this->stderrCallback(msg); }); - this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project); + this->CMakeInstance = + cm::make_unique<cmake>(cmake::RoleProject, cmState::Project); this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeGUICommand()); this->CMakeInstance->SetProgressCallback( @@ -55,11 +58,7 @@ QCMake::QCMake(QObject* p) } } -QCMake::~QCMake() -{ - delete this->CMakeInstance; - // cmDynamicLoader::FlushCache(); -} +QCMake::~QCMake() = default; void QCMake::loadCache(const QString& dir) { @@ -101,29 +100,28 @@ void QCMake::setBinaryDirectory(const QString& _dir) QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); - const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + cmProp homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); if (homeDir) { - setSourceDirectory(QString::fromLocal8Bit(homeDir)); + setSourceDirectory(QString::fromLocal8Bit(homeDir->c_str())); } - const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR"); + cmProp gen = state->GetCacheEntryValue("CMAKE_GENERATOR"); if (gen) { const std::string* extraGen = state->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator::CreateFullGeneratorName( - gen, extraGen ? *extraGen : ""); + *gen, extraGen ? *extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } - const char* platform = - state->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM"); + cmProp platform = state->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM"); if (platform) { - this->setPlatform(QString::fromLocal8Bit(platform)); + this->setPlatform(QString::fromLocal8Bit(platform->c_str())); } - const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET"); + cmProp toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET"); if (toolset) { - this->setToolset(QString::fromLocal8Bit(toolset)); + this->setToolset(QString::fromLocal8Bit(toolset->c_str())); } checkOpenPossible(); @@ -304,17 +302,17 @@ QCMakePropertyList QCMake::properties() const continue; } - const char* cachedValue = state->GetCacheEntryValue(key); + cmProp cachedValue = state->GetCacheEntryValue(key); QCMakeProperty prop; prop.Key = QString::fromLocal8Bit(key.c_str()); prop.Help = QString::fromLocal8Bit(state->GetCacheEntryProperty(key, "HELPSTRING")); - prop.Value = QString::fromLocal8Bit(cachedValue); + prop.Value = QString::fromLocal8Bit(cachedValue->c_str()); prop.Advanced = state->GetCacheEntryPropertyAsBool(key, "ADVANCED"); if (t == cmStateEnums::BOOL) { prop.Type = QCMakeProperty::BOOL; - prop.Value = cmIsOn(cachedValue); + prop.Value = cmIsOn(*cachedValue); } else if (t == cmStateEnums::PATH) { prop.Type = QCMakeProperty::PATH; } else if (t == cmStateEnums::FILEPATH) { |