[Qbs] "Multi" Properties

Christian Kandeler christian.kandeler at qt.io
Mon Dec 18 12:15:07 CET 2017


On Mon, 18 Dec 2017 14:04:21 +0300
Карелин Павел <hkarel at yandex.ru> wrote:

> In my project, I use the following construction:
> 
>      cpp.defines: {
>          var def = [];
>          if (project.simdDebug)
>              def.push("SIMD_DEBUG");
> 
>          if (project.useSimd)
>              def.push("USE_SIMD");
> 
>          return def;
>      }
> 
> It works fine.
> But I decided to experiment and do the same through "Properties"
> 
>      Properties {
>          condition: project.simdDebug
>          cpp.defines: outer.concat(["SIMD_DEBUG"])
>      }
>      Properties {
>          condition: project.useSimd
>          cpp.defines: outer.concat(["USE_SIMD"])
>      }
> 
> As a result, I get either SIMD_DEBUG or USE_SIMD at the output, but not 
> both at once.
> Is it possible to get both values immediately using "Properties"?

No, the Properties items form an implicit "else if" chain, so the conditions should be mutually exclusive if the same property appears in more than one of them. They are not well-suited for additive semantics like in your example.


Christian



More information about the Qbs mailing list