aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2022-07-13 13:46:16 +0200
committerEike Ziller <eike.ziller@qt.io>2022-07-13 12:32:03 +0000
commit550a7ecc6e373152515b179ccb909efd91138690 (patch)
tree6acb3ed9b296c242a1913808aadc8d64baf3b56f
parentc92216aea5bd1db747a1e74e5eebfacf0a591528 (diff)
BuildConfiguration: Do not update environment cache in constructor
Updating the environment cache calls into the virtual function BuildConfiguration::addToEnvironment (via BC::baseEnvironment()), and that is not working in the constructor yet. Move the call to updateCacheAndEmitEnvironmentChanged to BC::doInitialize. This fixes the build environment for the first CMake run on a newly created project. CMakeBuildConfiguration::addToEnvironment adds the PATH to the Ninja installation from the online installer. If that is missing, CMake will fail with a missing build tool, if Ninja isn't found anywhere else. Amends 65e043961e7267fbe4b0d897ee9922801c53035e Task-number: QTCREATORBUG-27495 Change-Id: I7c952db9029ab78e0aa9ea267444af163f5941ac Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index f867cc8bdd..0a5abd65d1 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -201,7 +201,6 @@ BuildConfiguration::BuildConfiguration(Target *target, Utils::Id id)
tr("Variables in the build configuration's environment"),
[this](const QString &var) { return environment().expandedValueForKey(var); });
- updateCacheAndEmitEnvironmentChanged();
connect(Core::ICore::instance(), &Core::ICore::systemEnvironmentChanged,
this, &BuildConfiguration::updateCacheAndEmitEnvironmentChanged);
connect(target, &Target::kitChanged,
@@ -292,6 +291,8 @@ void BuildConfiguration::addConfigWidgets(const std::function<void(NamedWidget *
void BuildConfiguration::doInitialize(const BuildInfo &info)
{
+ updateCacheAndEmitEnvironmentChanged();
+
setDisplayName(info.displayName);
setDefaultDisplayName(info.displayName);
setBuildDirectory(info.buildDirectory);