CMakePM: Reuse EnvironmentAspect for CMake configure environment

EnvironmentAspect is used in the Run configuration page.

For a configuration not using presets the "Build Environment" will be
used by default. This is the pre Qt Creator 9 behavior.

With presets "System Environment" is used, which allows the environment
sepparation of configure and build steps.

Fixes: QTCREATORBUG-28513
Change-Id: Ie65c0a5ac67355642460fca9fc618a1d29f4b1bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2023-01-02 20:03:41 +01:00
parent 567216bb49
commit 83a86bc4fe
5 changed files with 162 additions and 155 deletions

View File

@@ -8,6 +8,7 @@
#include <projectexplorer/buildaspects.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/environmentaspect.h>
namespace CMakeProjectManager {
class CMakeProject;
@@ -15,7 +16,6 @@ class CMakeProject;
namespace Internal {
class CMakeBuildSystem;
class CMakeBuildConfigurationPrivate;
class CMakeBuildSettingsWidget;
class CMakeProjectImporter;
@@ -45,14 +45,6 @@ public:
void addToEnvironment(Utils::Environment &env) const override;
Utils::Environment configureEnvironment() const;
void setUserConfigureEnvironmentChanges(const Utils::EnvironmentItems &diff);
Utils::EnvironmentItems userConfigureEnvironmentChanges() const;
bool useClearConfigureEnvironment() const;
void setUseClearConfigureEnvironment(bool b);
void updateAndEmitConfigureEnvironmentChanged();
Utils::Environment baseConfigureEnvironment() const;
QString baseConfigureEnvironmentText() const;
signals:
void signingFlagsChanged();
@@ -76,8 +68,6 @@ private:
friend class Internal::CMakeBuildSettingsWidget;
friend class Internal::CMakeBuildSystem;
Internal::CMakeBuildConfigurationPrivate *d = nullptr;
};
class CMAKE_EXPORT CMakeBuildConfigurationFactory
@@ -148,5 +138,16 @@ public:
using Utils::StringAspect::update;
};
class ConfigureEnvironmentAspect final: public ProjectExplorer::EnvironmentAspect
{
Q_OBJECT
public:
ConfigureEnvironmentAspect(ProjectExplorer::Target *target);
void fromMap(const QVariantMap &map);
void toMap(QVariantMap &map) const;
};
} // namespace Internal
} // namespace CMakeProjectManager