How to use compiler directives to define a build flag?

is there a way to use the compiler directives to accomplish something like the following?

#define ENABLE_DOUBLEWIDE_ATOMICS true
#if ENABLE_DOUBLEWIDE_ATOMICS

#else

#endif
-D ENABLE_DOUBLEWIDE_ATOMICS

apparently discourse won't let me just send the flag, so here is a sentence.

that is how you do it by customizing the build invocation, but how do you do it unconditionally within the source file?

the context is:

I don't believe there is a way to do it in Swift source today.

1 Like

Every now and then when I am reaching out for it I wish we had it:

#define someSwitch

#if someSwitch
// works
#else
// as expected
#endif
1 Like