diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-10-08 23:44:24 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-30 16:53:41 +0100 |
commit | 7eee2f66ef9e438565b9056e1f5ad73a62f15468 (patch) | |
tree | 0659bc99cec66e78a85bc079b5e19a9364bf3961 | |
parent | acc73fd24430df8fd3b9eb8c0736f868064f2fa4 (diff) |
qmake: Evaluate extra configs before loading default_pre
Exclusive builds uses setExtraConfigs to apply the particular CONFIG
of each build pass. Unfortunately we were not applying these extra
configs early enough in QMakeEvaluator::visitProFile() for them to
be picked up/usable by default_pre, something that can be useful.
Change-Id: I423a4688250a15f0c1a2cc65a48f0bbc14ad4497
(cherry picked from qtbase/eea1c359c9663cec15e7373c065ee06cba151eed)
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r-- | src/linguist/shared/qmakeevaluator.cpp | 24 | ||||
-rw-r--r-- | src/linguist/shared/qmakeevaluator.h | 1 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/linguist/shared/qmakeevaluator.cpp b/src/linguist/shared/qmakeevaluator.cpp index 5f304f3be..b589c176a 100644 --- a/src/linguist/shared/qmakeevaluator.cpp +++ b/src/linguist/shared/qmakeevaluator.cpp @@ -1276,6 +1276,14 @@ void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where) } } +void QMakeEvaluator::applyExtraConfigs() +{ + if (m_extraConfigs.isEmpty()) + return; + + evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)")); +} + QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConfigFeatures() { QSet<QString> processed; @@ -1382,14 +1390,19 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( it != m_extraVars.constEnd(); ++it) m_valuemapStack.first().insert(it.key(), it.value()); + // In case default_pre needs to make decisions based on the current + // build pass configuration. + applyExtraConfigs(); + if ((vr = evaluateFeatureFile(QLatin1String("default_pre.prf"))) == ReturnError) goto failed; - evaluateCommand(m_option->precmds, fL1S("(command line)")); + if (!m_option->precmds.isEmpty()) { + evaluateCommand(m_option->precmds, fL1S("(command line)")); - // After user configs, to override them - if (!m_extraConfigs.isEmpty()) - evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)")); + // Again, after user configs, to override them + applyExtraConfigs(); + } } debugMsg(1, "visiting file %s", qPrintable(pro->fileName())); @@ -1403,8 +1416,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( // Again, to ensure the project does not mess with us. // Specifically, do not allow a project to override debug/release within a // debug_and_release build pass - it's too late for that at this point anyway. - if (!m_extraConfigs.isEmpty()) - evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)")); + applyExtraConfigs(); if ((vr = evaluateFeatureFile(QLatin1String("default_post.prf"))) == ReturnError) goto failed; diff --git a/src/linguist/shared/qmakeevaluator.h b/src/linguist/shared/qmakeevaluator.h index 8a107223a..c1ba65eaf 100644 --- a/src/linguist/shared/qmakeevaluator.h +++ b/src/linguist/shared/qmakeevaluator.h @@ -172,6 +172,7 @@ public: void initFrom(const QMakeEvaluator &other); void setupProject(); void evaluateCommand(const QString &cmds, const QString &where); + void applyExtraConfigs(); VisitReturn visitProFile(ProFile *pro, QMakeHandler::EvalFileType type, LoadFlags flags); VisitReturn visitProBlock(ProFile *pro, const ushort *tokPtr); |