Although I’m a relative newcomer to JUCE, I’m an experienced C++ developer, otherwise used to creating generic libraries of re-usable components.
On initial examination, there would appear to be some obstacle to achieving this with JUCE: specifically on the basis of the statement in the generated (and end-application-specific) ‘JuceLibraryCode/JuceHeader.h’:
This is the header file that your files should include in order to get all the
JUCE library headers. You should avoid including the JUCE headers directly in
your own source files, because that wouldn’t pick up the correct configuration
options for your app.
I’m not sure what the consequences are of ‘not picking up the correct configuration’, but
this would appear to be at odds with the need for the (ideally, pre-compilable) source files in a generic library to have visibility of the JUCE headers.
One workaround would be for libraries to be ‘header only’ and have them rely on end application source files to #include them only after having #include’d .“JuceLibraryCode/JuceHeader.h”.
However, this would be brittle and hence undesirable.
Is there some better recommended practice in such cases?