[QBS] Properties and base.concat

Joerg Bornemann joerg.bornemann at nokia.com
Tue Mar 6 12:58:29 CET 2012


On 05/03/2012 14:43, ext Tom Sutcliffe wrote:

> * Specifying cpp.defines as a raw list is almost always the wrong thing
> to do - ie this is bad: cpp.defines: ["MY_DEFINE"]
> * Almost always you should be using base.concat - ie: cpp.defines:
> base.concat(["MY_DEFINE"])
> * Inside a group, you should probably use
> outer.concat(["GROUP_SPECIFIC_DEFINE"])

This is correct for the current situation and I do not like it very 
much. It should be ok to just use
       cpp.defines: ["MY_DEFINE"]
in a project but ATM this will override the value of cpp.defines the cpp 
module initially sets.

I propose to have cpp.defines initially empty and have another property 
for initial defines.

---CppModule.qbs---
property var defines: []

---windows-mingw.qbs---
property var platformDefines: ['UNICODE']

---myproject.qbp---
Application {
     Depends { name: "cpp" }
     cpp.defines: ['MY_DEFINE']
     //override cpp.platformDefines if needed
}

> Are there any other properties that we need to be wary of assigning
> directly to because of stuff done behind the scenes? Eg cpp.includePath?
> Is cpp.defines going to become enough of a gotcha that it'd be better to
> define UNICODE etc some other way (similar to what you said in your
> other mail I guess?). Is there any legitimate situation where you might
> want to exploit this behaviour to undefine a platform-defined macro?

For now its only the defines. Initial values for defines, includes and 
libs etc. in other modules than cpp are ok (like in qtcore or so).


Jörg



More information about the Qbs mailing list