Set swift macros from cmake

I have a swift project which uses macros for conditional compilation.

How to set macro: Go to Target -> BuildSettings -> Swift Compiler - Custom Flags -> Active Compilation Conditions and add your macro (Ex: sample macro - ELDIABLO in this case).

Then the following swift code,

#if ELDIABLO
NSLog("ELDIABLO macro detected!")
#else 
NSLog("ELDIABLO macro not detected!")
#endif

...produces the desired output.

ELDIABLO macro detected!

Now, how do I achieve this through cmake?

When I do the following,

set(CMAKE_Swift_FLAGS "${CMAKE_Swift_FLAGS} ELDIABLO")  

the macro gets added to Swift Compiler - Custom Flags -> Other Swift Flags (shown in the above image besides Active Compilation Conditions).

But it must be added in Swift Compiler - Custom Flags -> Active Compilation Conditions, else (here's why), it will not get detected in swift files.

How can I set swift macros in Active Compilation Conditions through cmake?

Set swift macros from cmake
 
 
Q