[QBS] share functionnality between projects

Joerg Bornemann joerg.bornemann at digia.com
Wed May 14 16:53:43 CEST 2014


On 14-May-14 14:31, olivier musse wrote:

> What is the best way to share source files and functionality among
> different projects.

If you don't the source compiled built with different build settings, 
then I recommend creating a static library, like you did.

Source file collections (like .pri files) are not supported yet. But 
there's suggestion QBS-59 for this feature.

One can achieve something similar by using inheritance and/or .js files. 
It's just not that nice.

> 2) How to share functionality between projects.
>   As an example, imagine I want to automatically generate a file
> according to project properties
[...]
> I would like the transformer to be share among many projects so that I
> only need to include in the project file a qbs file only containing this
> transformer.
> What is the best solution to do that ?

Put the transformer to a separate file, e.g. mytrafo.qbs.
Then import it
    import "somewhere/mytrafo.qbs" as MyTrafo
and instantiate it
    MyTrafo {
        // and maybe override properties here
    }


BR,

Joerg



More information about the Qbs mailing list