Creating a new audio plugin which shares code with an existing plugin

I have an existing JUCE-based audio plugin Projucer project, and I would now like to create a new plugin that shares the same source code (all files in the Source directory) but has a different name / identifier etc…

My initial idea for implementing this was to create a new Projucer project which is essentially a copy of the existing project other than a few required unique settings (project / plugin name, bundle identifier, plugin code etc…) but for it use the existing Source files instead of creating new source files. However this doesn’t work as the new project links to both the existing and new JuceLibraryCode files, which has a compilation error due duplicate ProjectInfo namespaces and the project doesn’t always use the correct JucePluginDefines.h file for macro access.

Are there any solutions for this scenario (either ‘official’ or solutions that other users have implemented) that don’t require a massive rewrite of the existing project?

Thanks.

The easiest way is to put the shared code in a JUCE module.

Check this thread to get started: Creating user modules tutorial?