[Qbs] Set properties via command line

Christian Kandeler christian.kandeler at qt.io
Thu Jun 8 12:45:16 CEST 2017


On Thu, 8 Jun 2017 11:51:55 +0200
Stephan Gatzka <stephan.gatzka at gmail.com> wrote:

> I have a problem to set a property in a product from the qbs command line:
> Product {
>    name: "unitTestRunner"
>    property bool showCoverageData: false
> 
>    ...
> 
>    Rule {
>      ...
>      prepare: {
>        if (product.showCoverageData) {
>        }
>      }
>    }
> }
> 
> If I run:
> qbs unitTestRunner.showCoverageData:true
> the if branch is never entered.

Yes, we "namespaced" the command-line property overrides, because there was potential for ambiguities, particularly between projects and products of the same name.
Your example should now read:

qbs products.unitTestRunner.showCoverageData:true

The other possible prefixes are "projects" and "modules".
We should probably emit a warning if the prefix is missing; I'll make a note.


Christian




More information about the Qbs mailing list