[Qbs] How to pass information to custom module via Depends ?

Christian Kandeler christian.kandeler at qt.io
Wed Feb 15 10:24:13 CET 2017


On 02/15/2017 02:51 AM, Glenn Coombs wrote:
> I have created a custom module to help wrap a dependency on the
> Qt5GStreamerUi library.  To use it I add a line like this:
> 
>     Depends { name: "Qt5GStreamerUi" }
> 
> to any project that needs to link against Qt5GStreamerUi.  It works fine
> but I would like to make the module more generic so that I can add a
> dependency on any library that pkg-config knows about.  I can't work out
> how to pass the name of the library through to the custom module.  I want
> to be able to write something like this:
> 
>     Depends { name: "PkgConfig"; packageName = "Qt5GStreamerUi" }
> 
> where PkgConfig would be the renamed and modified version of my existing
> Qt5GStreamerUi module.  Is there a way to do this ?

Depends { name: "PkgConfig" }
PkgConfig.packageName: "Qt5GStreamerUi"

Of course, this is not a viable general-purpose solution, as it limits
the PkgConfig module to one package per product.

Making the package name a list has a bunch of other problems. Also, in
the general case, you'd like to be able to find your library even if
there is no pkg-config (e.g. have fallback values for the library name
and look for it in well-known places), so usually you'll want a
dedicated named module. Perhaps a noninstantiable PkgConfig module item
would be the right solution; the concrete modules would then derive from it.

Either way, pkg-config is important enough to warrant a dedicated JIRA
task to discuss how to do it right. Feel free to open one.


Christian



More information about the Qbs mailing list