ProjectExplorer: Split EnvironmentAspect

... at least logically a bit more into hunks responsible for
one of the possible choices of base environments.

This makes it possible to move code that modifies individual
cases closer to the only place that uses it.

Change-Id: I1c87bb869e04e44b92ff097b0bf25274f93808be
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-03-07 10:10:22 +01:00
parent 9606e240f7
commit 6faaea8d0c
17 changed files with 160 additions and 190 deletions

View File

@@ -36,6 +36,7 @@
#include <projectexplorer/target.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace CMakeProjectManager {
namespace Internal {
@@ -43,17 +44,18 @@ namespace Internal {
CMakeRunConfiguration::CMakeRunConfiguration(Target *target, Core::Id id)
: RunConfiguration(target, id)
{
// Workaround for QTCREATORBUG-19354:
auto cmakeRunEnvironmentModifier = [target](Utils::Environment &env) {
if (!Utils::HostOsInfo::isWindowsHost())
return;
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
const Kit *k = target->kit();
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
if (qt)
env.prependOrSetPath(qt->qmakeProperty("QT_INSTALL_BINS"));
};
auto envAspect = addAspect<LocalEnvironmentAspect>(target, cmakeRunEnvironmentModifier);
// Workaround for QTCREATORBUG-19354:
if (HostOsInfo::isWindowsHost()) {
envAspect->addModifier([target](Environment &env) {
const Kit *k = target->kit();
if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k)) {
const QString installBinPath = qt->qmakeProperty("QT_INSTALL_BINS");
env.prependOrSetPath(installBinPath);
}
});
}
addAspect<ExecutableAspect>();
addAspect<ArgumentsAspect>();