[Qbs] Depending on item with dynamic name

Joerg Bornemann joerg.bornemann at qt.io
Thu Oct 12 10:22:32 CEST 2017


On 10/12/2017 08:26 AM, resurrection at centrum.cz wrote:

> is there a way do depend on a product with dynamically generated name? 
> Via id prehaps or some other identifier?
> 
> E.g.:
> 
> /import qbs/
> 
> /import qbs.FileInfo/
> 
> /Project/
> /{/
> /    Product/
> /    {/
> /        name: FileInfo.baseName(sourceDirectory)/
> /    }/
> /    Product/
> /    {/
> /        Depends { name: "???" }/
> /    }/
> /}/
> 
> Is there a way to depend on the first product in the second one?

Note the following in the docs for Product.name: "The value of this 
property must be a simple JavaScript expression that does not depend on 
module properties or values that are non-local to this product."

The following works though:

Project {
     property string theName: FileInfo.fileName(path)
     Product {
         name: project.theName
         ...
     }
     Product {
         Depends { name: project.theName }
         ...
     }
}

Christian, do we want to claim this as supported?



Joerg



More information about the Qbs mailing list