forked from qt-creator/qt-creator
CMakePM: Do not flush CMake parameters model on parsing complete
The flush there was as a "hack" for the case:
1. failed initial configuration (CMAKE_GENERATOR as Ninja2)
2. successful configuration
The current configuration would get current items with unexpanded
values e.g.: QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}
But flush also removed the expanded values of the selected
initial parameters from CMakeBuildSystem::updateInitialCMakeExpandableVars
This is useful when CMAKE_CXX_COMPILER changes or
CMAKE_PROJECT_INCLUDE_BEFORE gets a new path to the new Qt Creator.
Change-Id: I480ce141d043d8ba6001fa47a54b066762b6a128
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -365,7 +365,6 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
}
|
||||
|
||||
connect(bc->buildSystem(), &BuildSystem::parsingFinished, this, [this, stretcher] {
|
||||
m_configModel->flush();
|
||||
m_configModel->setConfiguration(m_buildConfiguration->configurationFromCMake());
|
||||
m_configModel->setInitialParametersConfiguration(
|
||||
m_buildConfiguration->initialCMakeConfiguration());
|
||||
@@ -1622,6 +1621,8 @@ void InitialCMakeArgumentsAspect::setAllValues(const QString &values, QStringLis
|
||||
arg.replace("-T", "-DCMAKE_GENERATOR_TOOLSET:STRING=");
|
||||
}
|
||||
m_cmakeConfiguration = CMakeConfig::fromArguments(arguments, additionalArguments);
|
||||
for (CMakeConfigItem &ci : m_cmakeConfiguration)
|
||||
ci.isInitial = true;
|
||||
|
||||
// Display the unknown arguments in "Additional CMake parameters"
|
||||
const QString additionalArgumentsValue = ProcessArgs::joinArgs(additionalArguments);
|
||||
@@ -1631,6 +1632,8 @@ void InitialCMakeArgumentsAspect::setAllValues(const QString &values, QStringLis
|
||||
void InitialCMakeArgumentsAspect::setCMakeConfiguration(const CMakeConfig &config)
|
||||
{
|
||||
m_cmakeConfiguration = config;
|
||||
for (CMakeConfigItem &ci : m_cmakeConfiguration)
|
||||
ci.isInitial = true;
|
||||
}
|
||||
|
||||
void InitialCMakeArgumentsAspect::fromMap(const QVariantMap &map)
|
||||
|
||||
@@ -272,11 +272,12 @@ void ConfigModel::setInitialParametersConfiguration(const CMakeConfig &config)
|
||||
|
||||
void ConfigModel::setConfiguration(const QList<ConfigModel::InternalDataItem> &config)
|
||||
{
|
||||
QList<InternalDataItem> tmp = config;
|
||||
auto newIt = tmp.constBegin();
|
||||
auto newEndIt = tmp.constEnd();
|
||||
auto oldIt = m_configuration.constBegin();
|
||||
auto oldEndIt = m_configuration.constEnd();
|
||||
auto mergeLists = [](const QList<InternalDataItem> &oldList,
|
||||
const QList<InternalDataItem> &newList) -> QList<InternalDataItem> {
|
||||
auto newIt = newList.constBegin();
|
||||
auto newEndIt = newList.constEnd();
|
||||
auto oldIt = oldList.constBegin();
|
||||
auto oldEndIt = oldList.constEnd();
|
||||
|
||||
QList<InternalDataItem> result;
|
||||
while (newIt != newEndIt && oldIt != oldEndIt) {
|
||||
@@ -311,7 +312,21 @@ void ConfigModel::setConfiguration(const QList<ConfigModel::InternalDataItem> &c
|
||||
result << InternalDataItem(*newIt);
|
||||
}
|
||||
|
||||
m_configuration = result;
|
||||
return result;
|
||||
};
|
||||
|
||||
auto isInitial = [](const InternalDataItem &i) { return i.isInitial; };
|
||||
|
||||
QList<InternalDataItem> initialOld;
|
||||
QList<InternalDataItem> currentOld;
|
||||
std::tie(initialOld, currentOld) = Utils::partition(m_configuration, isInitial);
|
||||
|
||||
QList<InternalDataItem> initialNew;
|
||||
QList<InternalDataItem> currentNew;
|
||||
std::tie(initialNew, currentNew) = Utils::partition(config, isInitial);
|
||||
|
||||
m_configuration = mergeLists(initialOld, initialNew);
|
||||
m_configuration.append(mergeLists(currentOld, currentNew));
|
||||
|
||||
generateTree();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user