[QBS] Setting multiple profiles for sub-projects

Christian Kandeler christian.kandeler at theqtcompany.com
Mon Aug 10 09:40:48 CEST 2015

On 08/09/2015 07:19 PM, Stephan Gatzka wrote:
> I setup successfully qbs to build my cjet project. For continuous
> integration I'd like to setup a "surrounding" qbs file which sets the
> profiles the cjet project:
> Project {
>     name: "cjet CI"
>     minimumQbsVersion: "1.4.0"
>     SubProject {
>       filePath: "cjet.qbs"
>       Properties {
>         name: "cjet"
>         profiles: ["gcc", "clang"]

The Project item has no "profiles" property. You might want to report it 
as a bug if you don't get a warning here.

>       }
>     }
>     Product {
>       name: "cjet continuous integration"
>       Depends { name: "cjet" }
>       profiles: ["gcc", "clang"]
>     }
> }
> If I use this file. I get the error:
> Product dependency 'cjet' not found for profile 'gcc'.
> So it only seem to work if I also set profiles in the cjet.qbs file. But
> that is something I didn't want to because I often have to cross compile
> this program and don't know the profile beforehand.
> Nevertheless, for a continuous build a selection of some pre-defined
> profiles would be helpful. Is that possible to be specified in a qbs
> file like above or do I have to run qbs repeatedly with different profiles?

It seems to me that what you are trying to do is not what the "profiles" 
property is for. The use case it is intended to support is projects that 
need to incorporate different architectures in the same build (e.g. 
Android projects or cross-compiled projects that need to build host 
tools as well). Your use case, if I understand correctly, is much 
simpler in that you just want to build your entire project for different 
profiles. This is achieved by just giving the profiles on the command line:
     $ qbs build profile:gcc profile:clang
This will create two separate builds in parallel.


More information about the Qbs mailing list