[QBS] Properties for multiple conditions

Markus Biggel sicus01 at googlemail.com
Mon Dec 16 13:29:09 CET 2013


I want to set up a project with properties to set macros, now more than one
property can be true, but this does not work. how can I realize this. for
example:

I want the macro LNX_DEFINE under linux, WIN_DEFINE under windows,
DBG_DEFINE if the project is build as debug and MY_DEFINE which is always
set. I tried the following:

//--------------- part of qbs file --------------------------------
Properties {
  condition: qbs.targetOS.contains("linux")
  cpp.defines: LNX_DEFINE
}

Properties {
  condition: qbs.targetOS.contains("windows")
  cpp.defines: WIN_DEFINE
}

Properties {
  condition: qbs.buildVariant.contains("debug")
  cpp.defines: DBG_DEFINE
}

Properties {
  condition: true
  cpp.defines: MY_DEFINE
}
//-----------------------------------------------

If I build debug on linux, I expected to see LNX_DEFINE, DBG_DEFINE and
MY_DEFINE set, release on windows WIN_DEFINE and MY_DEFINE and so on. But
this is not the case, the first true condition is set, all conditions below
are ignored. it looks like this is equivalent to
if (targetOS.contains("linux") {}
else if (targetOS.contains("windows")) {}
else if (buildVariant.contains("debug") {}

But I need something like:
if (targetOS.contains("linux") {}
if (targetOS.contains("windows")) {}
if (buildVariant.contains("debug") {}

or, at least, the buildVariant condition is treated seperately from
targetOS (two ore more blocks of buildVariant or targetOS can be, of couse,
if - else equivalents), like:

if (targetOS.contains("linux") {}
else if (targetOS.contains("windows") {}
if (buildVariant.contains("debug") {}

Is there a way to realize this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20131216/d62e7640/attachment.html>


More information about the Qbs mailing list