forked from qt-creator/qt-creator
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 <eike.ziller@qt.io>
This commit is contained in:
@@ -339,10 +339,14 @@ bool BuildConfiguration::isActive() const
|
|||||||
* to provide hints about which compiler to use.
|
* to provide hints about which compiler to use.
|
||||||
*/
|
*/
|
||||||
void BuildConfiguration::prependCompilerPathToEnvironment(Utils::Environment &env) const
|
void BuildConfiguration::prependCompilerPathToEnvironment(Utils::Environment &env) const
|
||||||
|
{
|
||||||
|
return prependCompilerPathToEnvironment(target()->kit(), env);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfiguration::prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env)
|
||||||
{
|
{
|
||||||
const ToolChain *tc
|
const ToolChain *tc
|
||||||
= ToolChainKitInformation::toolChain(target()->kit(),
|
= ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
|
||||||
|
|
||||||
if (!tc)
|
if (!tc)
|
||||||
return;
|
return;
|
||||||
|
@@ -91,6 +91,7 @@ public:
|
|||||||
bool isActive() const override;
|
bool isActive() const override;
|
||||||
|
|
||||||
void prependCompilerPathToEnvironment(Utils::Environment &env) const;
|
void prependCompilerPathToEnvironment(Utils::Environment &env) const;
|
||||||
|
static void prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void environmentChanged();
|
void environmentChanged();
|
||||||
|
@@ -760,9 +760,14 @@ BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
|
|||||||
|
|
||||||
void QmakeBuildConfiguration::addToEnvironment(Environment &env) const
|
void QmakeBuildConfiguration::addToEnvironment(Environment &env) const
|
||||||
{
|
{
|
||||||
prependCompilerPathToEnvironment(env);
|
setupBuildEnvironment(target()->kit(), env);
|
||||||
const BaseQtVersion *qt = QtKitInformation::qtVersion(target()->kit());
|
}
|
||||||
if (qt)
|
|
||||||
|
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());
|
env.prependOrSetPath(qt->binPath().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -100,6 +100,7 @@ public:
|
|||||||
BuildType buildType() const override;
|
BuildType buildType() const override;
|
||||||
|
|
||||||
void addToEnvironment(Utils::Environment &env) const override;
|
void addToEnvironment(Utils::Environment &env) const override;
|
||||||
|
static void setupBuildEnvironment(ProjectExplorer::Kit *k, Utils::Environment &env);
|
||||||
|
|
||||||
void emitProFileEvaluateNeeded();
|
void emitProFileEvaluateNeeded();
|
||||||
|
|
||||||
|
@@ -665,6 +665,10 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *
|
|||||||
else
|
else
|
||||||
qmakeArgs = bc->configCommandLineArguments();
|
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);
|
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
|
Reference in New Issue
Block a user