Many thanks for all the suggestions.
Since NEEDEDFLAG can also be set by:
nim c -d:NEEDEDFLAG etc.etc.
Run
I need to use defined(NEEDEDFLAG) instead of declared(NEEDEDFLAG).
However the following inside nim.cfg worked for me:
@if BGMAP:
define:
One that hasn't been mentioned yet is simply:
const NeededFlag = defined(DependentFlag)
when NeededFlag:
discard # code goes here
Run
Actually Nim has {.define: identifier.} pragma, but then it was deprecated. I'm
curious to know what was the reason. Doesn't it behave similarly with '-d:' or
'\--define:'?
I use a [nim.cfg in
Arraymancer](https://github.com/mratsim/Arraymancer/blob/7edf23662328c059cd22be4cd08c00556321e4d1/nim.cfg#L43):
@if cudnn:
define:"cuda"
@end
Run
i just want to say, i love how many good options nim has for such a simple
thing.
Nim -- a buffet for the programmers taste
{. emit: """#define SOMEOPTION""" .}
Run
Literal, For C target.
Is there a pragma (or some such) that performs like the C preprocessor command:
#define SOMEOPTION
Run
I would like definition of some debugging flags to automatically define others.
For example:
when defined(DEPENDENTFLAG):
{.define(NEEDEDFLAG
const Thing = 0
when declared(Thing):
const otherThing = 0
when declared(otherThing):
echo "we are here"
Run
this works