diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-02-22 18:01:45 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-02-24 12:13:32 +0000 |
commit | b4f2cbdcf08913f4c76535e0ffb6c1fdc559c742 (patch) | |
tree | cf7da7921fcfecd2bb41e338a037b711711e4900 /share | |
parent | 14c2312db4d95197a9fe3b07802264aa478aba20 (diff) |
Support multiple package names in PkgConfigProbe
Reduces the overhead when querying for related packages.
Change-Id: I217942447740987e6890b25fe48ddf7336debacd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs b/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs index d9fcacf5d..1af67560f 100644 --- a/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs +++ b/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs @@ -37,6 +37,7 @@ Probe { property string sysroot: qbs.sysroot property string executable: 'pkg-config' property string name + property stringList packageNames: [name] property string minVersion property string exactVersion property string maxVersion @@ -56,17 +57,17 @@ Probe { property string modversion configure: { - if (!name) - throw '"name" must be specified'; + if (!packageNames || packageNames.length === 0) + throw 'PkgConfigProbe.packageNames must be specified.'; var p = new Process(); try { - var args = [ name ]; + var args = packageNames; if (minVersion !== undefined) - args.push(name + ' >= ' + minVersion); + args.unshift("--atleast-version=" + minVersion); if (exactVersion !== undefined) - args.push(name + ' = ' + exactVersion); + args.unshift("--exact-version=" + exactVersion); if (maxVersion !== undefined) - args.push(name + ' <= ' + maxVersion); + args.unshift("--max-version=" + maxVersion); var libDirsToSet = libDirs; if (sysroot) { p.setEnv("PKG_CONFIG_SYSROOT_DIR", sysroot); @@ -88,7 +89,7 @@ Probe { if (p.exec(executable, libsArgs) === 0) { libs = p.readStdOut().trim(); libs = libs ? libs.split(/\s/) : []; - if (p.exec(executable, args.concat([ '--modversion' ])) === 0) { + if (p.exec(executable, [packageNames[0]].concat([ '--modversion' ])) === 0) { modversion = p.readStdOut().trim(); found = true; includePaths = []; @@ -115,7 +116,7 @@ Probe { else linkerFlags.push(flag); } - console.info("PkgConfigProbe: found library " + name); + console.debug("PkgConfigProbe: found packages " + packageNames); return; } } |