From 6f735b683948f24b47cd6da1fccbc3bd7c5400e3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 Jul 2017 17:42:27 +0200 Subject: configure: factor out $$qtConfScalarOrList() we'll need it in more places. Change-Id: Ia7e3d9ea4a27cc01294bde4cafe6721eb9f59343 Reviewed-by: Thiago Macieira --- mkspecs/features/qt_configure.prf | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'mkspecs/features/qt_configure.prf') diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index f3db6b467d..4b2ba560fb 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -34,6 +34,18 @@ defineTest(qtConfFatalError) { error() } +# Return a string list for the specified JSON path, which may be either a +# single string or an array of strings. +# Note that this returns a variable name, so it can be directly iterated over. +defineReplace(qtConfScalarOrList) { + defined($$1, var): return($$1) + vals = $$list() + for (i, $${1}._KEYS_): \ + $$vals += $$eval($${1}.$$i) + export($$vals) + return($$vals) +} + defineTest(qtConfCommandlineSetInput) { arg = $${1} val = $${2} @@ -1340,17 +1352,10 @@ defineTest(qtConfCheckFeature) { # feature not auto-detected and not explicitly enabled result = false } else { - condition = $$eval($${fpfx}.condition) - !isEmpty(condition) { + result = true + for (condition, $$qtConfScalarOrList($${fpfx}.condition)) { result = $$qtConfCheckSingleCondition($$1, $$condition, $$enabled) - } else { - result = true - # check whether we have an array of conditions - for (i, $${fpfx}.condition._KEYS_) { - condition = $$eval($${fpfx}.condition.$$i) - result = $$qtConfCheckSingleCondition($$1, $$condition, $$enabled) - !$$result: break() - } + !$$result: break() } } $${fpfx}.available = $$result -- cgit v1.2.3