Author Topic: Question about conditionnal variables settings  (Read 2390 times)

Offline SamSam

  • Single posting newcomer
  • *
  • Posts: 2
Question about conditionnal variables settings
« on: May 17, 2019, 09:41:41 am »
Hi,

Let's say that on my project I have a "Project build option / Custom variables" called "VarType" which is filled by user
"VarType" can be equal to "ABC" or "DEF".

I would like to use a different compilation switch depending on VarType (so that is is activated without user needs to remember it).
For instance:
- if "VarType =  ABC" then we add -DBLABLA in compiler toolchain.
- if "VarType =  DFE" then we add -DBLUBLU in compiler toolchain.


I tried to do it in #defines folder doing something like this:

$if($VarType = ABC){BLABLABLA}{BLUBLU}

or

$if($VarType == ABC){BLABLABLA}{BLUBLU}

But it does not work fine.

Is there a way to do it or can $if() be used only without any statement in it? (= only checking if value is 0 or something).

If not possible do you have another idea of how I could do it?






Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Question about conditionnal variables settings
« Reply #1 on: May 18, 2019, 11:59:59 am »
The
Code
$if(){}{}
macro is completely broken: https://sourceforge.net/p/codeblocks/tickets/520/

If there are no future objections i will commit them in the next two days, then your use case should work

Offline SamSam

  • Single posting newcomer
  • *
  • Posts: 2
Re: Question about conditionnal variables settings
« Reply #2 on: May 20, 2019, 09:34:30 am »
It would be great! Thanks!   :)