[QBS] Get property from parent project

Christian Kandeler christian.kandeler at digia.com
Thu May 22 13:40:03 CEST 2014

On 05/22/2014 01:26 PM, olivier musse wrote:
> I have a project with subproject and so on.
> When in a product or a subproject, how to access parent project
> properties. Sometimes it seems to be "project.MyProperty", sometimes
> "MyProperty"
> Is there any documentation to clarify this point?

Simple: Project properties are inherited by sub-projects. If you use the 
property outside of a Project item, you need to access it via the magic 
"project" property.

> As an example
> Project {
>       property string myprop1 : "val1"
>       product{
>           property string myproductprop
>           Depends{name:project.myprop1}     //in this case seems the
> project prefix is needed

Yes, because you are not directly in a Project item.

>           myproductprop:myprop1 //in this case with project prefix it
> does not work and seems to works without it

No, I don't think so. If you are sure about it, please file a bug report 
and attach the complete project.


More information about the Qbs mailing list