How are Swift macros handled from other modules?

I recently refactored a project to break out common code into a Swift Package Manager (SPM) package. The code itself references macros such as DEBUG that are defined by the host application via a Swift Active Compilation Condition.

However from what I can tell, modules outside of the main app are unable to access these macros. E.g. if the SPM package does this:

#if DEBUG
print("debug mode!")
#endif

…the print() will never execute.

Is there any way for an SPM package to access these macro definitions? If not, is there a recommended best practice for including "debug only" code in an SPM package?

Thanks!

How are Swift macros handled from other modules?
 
 
Q