[QBS] propagate compiler options

Marcel Mulder marcel.mulder at xs4all.nl
Tue Jan 13 19:46:50 CET 2015


> 
> Am I getting You right, that You want to set some toolchain options in a
> product and all parent products should be build with the same options? Even
> though that makes sense in Your case, think about the following example
> which is not uncommon:
> 
> Product A depends on product C
> Product B depends also on product C.
> 
> Let's assume product C defines some default toolchain options. When product
> A defines its own toolchain flags and product B does that as well, what
> would happen with the options in product C? You can not simply override them
> with the options of a dependent product A/B. Product C would have to be
> build twice - with different options for A and B. But QBS builds every
> product exactly once during a build procedure.
> 
> A straight forward solution for the above scenario would be, to define all
> common toolchain options in the toolchain profile.
> 

No, you don’t get it right. I want to propagate down, not up. So the parent product determines the compile options of the siblings.
In your case Product A defines the compile options for Product C when building A and Product B defines the compile option for Product C when building B.
Do you know how I can do that? Because when a build for example product A than product C is build with the cpp module defaults and not with the compile options of product A.
Product C should however be able to override or add compile options.

> 
>> It is actually strange that something simple like
>> compile options can’t be propagated or that files can be simply added to
>> the files: [] list. For example like:
>> 
>> Export { files: [ foo.c ] }
>> 
>> I tried to look into the code and add it myself, but I have to take more
>> time to understand the structure of the abs sources.
> 
> What exactly are You going to achieve with that?
> 

What I want to achieve is what I described above. When it can’t be done with the current implementation of qbs it should be added because I think that this is core functionality.
With qmake I use .pri file to achieve the same and with make files people do it all the time. At least in my world, the embedded one.

Regards, Marcel





More information about the Qbs mailing list