diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 0c241193a1c..5183a9edb43 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -1297,10 +1297,28 @@ bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex if (Option::target_mode == Option::TARG_WIN_MODE && config == QLatin1String("win32")) return true; - QRegExp re(config, Qt::CaseSensitive, QRegExp::Wildcard); - QString spec = Option::qmakespec; - if ((regex && re.exactMatch(spec)) || (!regex && spec == config)) - return true; + if (regex) { + QRegExp re(config, Qt::CaseSensitive, QRegExp::Wildcard); + + if (re.exactMatch(Option::qmakespec)) + return true; + + // CONFIG variable + foreach (const QString &configValue, m_valuemap.value(QLatin1String("CONFIG"))) { + if (re.exactMatch(configValue)) + return true; + } + } else { + // mkspecs + if (Option::qmakespec == config) + return true; + + // CONFIG variable + foreach (const QString &configValue, m_valuemap.value(QLatin1String("CONFIG"))) { + if (configValue == config) + return true; + } + } return false; } diff --git a/tests/auto/profilereader/data/includefiles/test.pro b/tests/auto/profilereader/data/includefiles/test.pro index 0c2209a7c34..2939b5fbfd0 100644 --- a/tests/auto/profilereader/data/includefiles/test.pro +++ b/tests/auto/profilereader/data/includefiles/test.pro @@ -1,3 +1,6 @@ include(test.pri) SOURCES += pro.cpp + +CONFIG += testscope +testscope:SCOPED_VARIABLE = 1 diff --git a/tests/auto/profilereader/main.cpp b/tests/auto/profilereader/main.cpp index fa50aa59b14..0f6a3587dcb 100644 --- a/tests/auto/profilereader/main.cpp +++ b/tests/auto/profilereader/main.cpp @@ -45,23 +45,32 @@ class tst_ProFileReader : public QObject private slots: void readProFile(); void includeFiles(); + void conditionalScopes(); }; void tst_ProFileReader::readProFile() { - ProFileCache cache; - ProFileReader reader(&cache); + ProFileReader reader; QCOMPARE(reader.readProFile("nonexistant"), false); QCOMPARE(reader.readProFile("data/includefiles/test.pro"), true); } void tst_ProFileReader::includeFiles() { - ProFileCache cache; - ProFileReader reader(&cache); + ProFileReader reader; QCOMPARE(reader.readProFile("data/includefiles/test.pro"), true); QCOMPARE(reader.includeFiles().size(), 2); } +void tst_ProFileReader::conditionalScopes() +{ + ProFileReader reader; + QCOMPARE(reader.readProFile("data/includefiles/test.pro"), true); + + QStringList scopedVariable = reader.values("SCOPED_VARIABLE"); + QCOMPARE(scopedVariable.count(), 1); + QCOMPARE(scopedVariable.first(), QLatin1String("1")); +} + QTEST_MAIN(tst_ProFileReader) #include "main.moc"