forked from qt-creator/qt-creator
ProjectExplorer: Do not prepend compiler path to PATH everywhere!
Do not unconditionally prepend the (c++) compiler path to PATH for all projects using GCC-derived toolchains. Prepend the compiler path in the Qmake- and GenericBuildConfigurations instead. Also change the order: Apply buildconfiguration's addToEnvironment first, only then apply the kit's addToEnvironment. This does change a few things: * CMake and Qbs will now get the normal PATH * MSVC compilers will have their compiler path prepended to PATH by the effected BuildConfigurations. This should be harmless, since that happens before the environment setup script is appended. Task-number: QTCREATORBUG-18714 Change-Id: I548182bc447d80d24f4de4ce7cf12ee1a753ed26 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -33,7 +33,10 @@
|
||||
#include "kit.h"
|
||||
|
||||
#include <projectexplorer/buildenvironmentwidget.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectmacroexpander.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
@@ -238,8 +241,8 @@ Utils::Environment BuildConfiguration::baseEnvironment() const
|
||||
Utils::Environment result;
|
||||
if (useSystemEnvironment())
|
||||
result = Utils::Environment::systemEnvironment();
|
||||
target()->kit()->addToEnvironment(result);
|
||||
addToEnvironment(result);
|
||||
target()->kit()->addToEnvironment(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -330,6 +333,25 @@ bool BuildConfiguration::isActive() const
|
||||
return target()->isActive() && target()->activeBuildConfiguration() == this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Helper function that prepends the directory containing the C++ toolchain to
|
||||
* PATH. This is used to in build configurations targeting broken build systems
|
||||
* to provide hints about which compiler to use.
|
||||
*/
|
||||
void BuildConfiguration::prependCompilerPathToEnvironment(Utils::Environment &env) const
|
||||
{
|
||||
const ToolChain *tc
|
||||
= ToolChainKitInformation::toolChain(target()->kit(),
|
||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
|
||||
if (!tc)
|
||||
return;
|
||||
|
||||
const Utils::FileName compilerDir = tc->compilerCommand().parentDir();
|
||||
if (!compilerDir.isEmpty())
|
||||
env.prependOrSetPath(compilerDir.toString());
|
||||
}
|
||||
|
||||
///
|
||||
// IBuildConfigurationFactory
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user