News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Question about conditionnal variables settings

Started by SamSam, May 17, 2019, 09:41:41 AM

Previous topic - Next topic

SamSam

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?






BlueHazzard

The
$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

SamSam