CMakePM: Migrate build environment settings also to configure step

This allows a project to be properly configured with Qt Creator 9 when
the build environment had user defined changes.

Qt Creator version prior to 9 had one setting for both configure and
build steps.

Fixes: QTCREATORBUG-28372
Change-Id: I0da8065085bd6628ba75923c17b46648eb031801
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2022-11-29 19:53:41 +01:00
parent d5b585dad6
commit e0a563b236
3 changed files with 26 additions and 9 deletions

View File

@@ -1621,10 +1621,24 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
m_buildSystem->setInitialCMakeArguments(cmd.splitArguments());
}
d->m_clearSystemConfigureEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY))
.toBool();
// Upgrading from Qt Creator version <9 to 9, if the build environment is set
// apply the specific values to the configure environment
auto settingsKey = [map](const QLatin1String &configureKey, const QLatin1String &buildKey) {
if (!map.contains(configureKey) && map.contains(buildKey))
return buildKey;
return configureKey;
};
const QLatin1String clearSystemEnvironmentKey
= settingsKey(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY),
QLatin1String(ProjectExplorer::Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY));
const QLatin1String userEnvironmentChangesKey
= settingsKey(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY),
QLatin1String(ProjectExplorer::Constants::USER_ENVIRONMENT_CHANGES_KEY));
d->m_clearSystemConfigureEnvironment = map.value(clearSystemEnvironmentKey).toBool();
d->m_userConfigureEnvironmentChanges = EnvironmentItem::fromStringList(
map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
map.value(userEnvironmentChangesKey).toStringList());
updateAndEmitConfigureEnvironmentChanged();