From 550a7ecc6e373152515b179ccb909efd91138690 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 13 Jul 2022 13:46:16 +0200 Subject: [PATCH] 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 --- src/plugins/projectexplorer/buildconfiguration.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index f867cc8bdd2..0a5abd65d19 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