[QBS] Global and local properties in projects and products

Richard Weickelt richard at weickelt.de
Fri Jul 25 15:12:52 CEST 2014


Hi,

I have a project containing a couple of static libraries. This project is
then being used as a sub-project for application projects.

Illustration of the project structure
-------------------------------------

Project { name : "framework" }
|
+-- StaticLibrary { name : "lib1" }
+-- StaticLibrary { name : "lib2" }
..

Project { name: "app" }
|
+-- SubProject { filePath : "path/to/framework.qbs" }
+-- Application { name : "myApplication" }

Question
--------
When building "myApplication", different configuration options come to my mind:
1. Global properties with influence to every product inside "framework"
   and "app"
2. Local properties, only valid for "lib1" or "lib2"

For 1. the module approach seems to fit in. I have created a module with all
the necessary properties. But this has the drawback, that those properties
can only be chosen either in the build-profile or on command line. Writing
to module properties on project level seems to be impossible. And if I set a
module property on product level, it is only valid in the scope of the same
product.

Another approach would be, to define a property in both, project "framework"
and project "app". All subproducts can then access "project.myGlobalProperty".

For 2. I could not find an adequate solution. Of course, I could also use
global properties as described in 1. But is this really the way to go?

Thanks
Richard



More information about the Qbs mailing list