From 4e57609dc7ccd824fcb16c0e16669985397f6fb8 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 23 Feb 2022 12:33:23 +0100 Subject: [PATCH] PE: Avoid device compilers while handling local toolchains ...and fix environment used when processing them. Change-Id: I457c31e195f41ca2edf105229f2818dddd2f5df0 Reviewed-by: hjk --- src/plugins/projectexplorer/gcctoolchain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 155a2e2eec4..ad3ab0133f1 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -697,7 +697,7 @@ void GccToolChain::addToEnvironment(Environment &env) const { // On Windows gcc invokes cc1plus which is in libexec directory. // cc1plus depends on libwinpthread-1.dll which is in bin, so bin must be in the PATH. - if (HostOsInfo::isWindowsHost()) + if (compilerCommand().osType() == OsTypeWindows) addCommandPathToEnvironment(compilerCommand(), env); } @@ -1223,7 +1223,7 @@ Toolchains GccToolChainFactory::autoDetectToolChain(const ToolChainDescription & { Toolchains result; - Environment systemEnvironment = Environment::systemEnvironment(); + Environment systemEnvironment = tcd.compilerPath.deviceEnvironment(); GccToolChain::addCommandPathToEnvironment(tcd.compilerPath, systemEnvironment); const FilePath localCompilerPath = findLocalCompiler(tcd.compilerPath, systemEnvironment); if (ToolChainManager::isBadToolchain(localCompilerPath)) @@ -1430,7 +1430,7 @@ void GccToolChainConfigWidget::handleCompilerCommandChange() haveCompiler = fi.isExecutable() && fi.isFile(); } if (haveCompiler) { - Environment env = Environment::systemEnvironment(); + Environment env = path.deviceEnvironment(); GccToolChain::addCommandPathToEnvironment(path, env); QStringList args = gccPredefinedMacrosOptions(Constants::CXX_LANGUAGE_ID) + splitString(m_platformCodeGenFlagsLineEdit->text());