Commit 78ef474c authored by Tobias Hunger's avatar Tobias Hunger

Qmake: Set up environment for initial project parsing

Set up a better environment for initial project parsing (before Kits
are configured).

Task-number: QTCREATORBUG-19241
Change-Id: I2431113dbbe6fb6a66f95fb1efb36834fa184f3d
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 8c3bd615
......@@ -339,10 +339,14 @@ bool BuildConfiguration::isActive() const
* to provide hints about which compiler to use.
*/
void BuildConfiguration::prependCompilerPathToEnvironment(Utils::Environment &env) const
{
return prependCompilerPathToEnvironment(target()->kit(), env);
}
void BuildConfiguration::prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env)
{
const ToolChain *tc
= ToolChainKitInformation::toolChain(target()->kit(),
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
= ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (!tc)
return;
......
......@@ -91,6 +91,7 @@ public:
bool isActive() const override;
void prependCompilerPathToEnvironment(Utils::Environment &env) const;
static void prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env);
signals:
void environmentChanged();
......
......@@ -760,9 +760,14 @@ BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
void QmakeBuildConfiguration::addToEnvironment(Environment &env) const
{
prependCompilerPathToEnvironment(env);
const BaseQtVersion *qt = QtKitInformation::qtVersion(target()->kit());
if (qt)
setupBuildEnvironment(target()->kit(), env);
}
void QmakeBuildConfiguration::setupBuildEnvironment(Kit *k, Environment &env)
{
prependCompilerPathToEnvironment(k, env);
const BaseQtVersion *qt = QtKitInformation::qtVersion(k);
if (qt && !qt->binPath().isEmpty())
env.prependOrSetPath(qt->binPath().toString());
}
......
......@@ -100,6 +100,7 @@ public:
BuildType buildType() const override;
void addToEnvironment(Utils::Environment &env) const override;
static void setupBuildEnvironment(ProjectExplorer::Kit *k, Utils::Environment &env);
void emitProFileEvaluateNeeded();
......
......@@ -665,6 +665,10 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *
else
qmakeArgs = bc->configCommandLineArguments();
}
} else {
// Set up a better default environment without using a build configuration:
QmakeBuildConfiguration::setupBuildEnvironment(k, env);
k->addToEnvironment(env);
}
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment