FR: A macro that is defined for each module included



for some module-based stuff I’m building it would be really helpful if I had the opportunity to wrap parts of my code into #ifdef statements to enable/disable functionality depending on the presence of some modules (JUCE modules as well as user modules) in the project. This is a different approach to making some modules a mandatory dependency for my modules as I explicitly want the choice to add functionality if a certain module is included but do not want to make this module a dependency.

So what about automatically defining a macro like JUCE_MODULE_module_name_IS_PRESENT_IN_PROJECT for each module added to the project.

If there already is any functionality like that present in the library I’d be glad to be pointed to it, however I haven’t found anything like that so far.


There is a JUCE_MODULE_AVAILABLE_ macro for each module so you could do something like:

#if JUCE_MODULE_AVAILABLE_juce_graphics
    // do stuff...


Just to improve my skills for helping myself - where should I have looked for some documentation on that feature? :wink:


The AppConfig.h file which is generated in JuceLibraryCode is where all of the project-specific #defines tend to live.