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).
Are you sure the flag doesn’t have some prefix like -D to tell it how to use your ELDIABLO name? As it is…is it a source file, a file to link, or something else?
-D is required when setting macro to Other Swift Flags
When setting to Active Compilation Condition, -D is not required.
We are trying to set these SWIFT flags in CMakePreset.json or cmake file. We could not find a way how to set a flag in CMake which gets reflected in xcode’s Active Compilation Conditions which Swift uses for macro.
flag ELDIABLO gets passed to Other Swift Flags in xcode. But we want to know if there is a way in cmake to pass Active Compilation Condition flags to Swift.
There might not be a way right now. That is, what is done now has been sufficient for building, but for actual Xcode users it might be non-optimal. I suggest filing a new issue detailing what behavior differences occur when the flag is recategorized.