Duplicate VST Target not recognizing Preprocessor Macro

I need to make two versions of my VST plugin. In XCode, I duplicate the VST target generated by Projucer and added a preprocessor macro (IS_EQIP=1) to the new duplicate version. In my source code I check for the preprocessor macro like I always do:

    // do stuff
    // do other stuff

But the is_eqip version acts as if it doesn’t have that preprocessor macro set to 1 (it does “other stuff”). I’ve done this with my standalone application that’s built on JUCE, without issue. But for some reason the plugin won’t cooperate. Is there some other possible setting I need to change?

I’m asking here to see if it’s possible the Projucer has created the various targets in a way that is preventing this from working.

The Xcode project generated by Projucer for a VST plugin called “MyPlugin” contains at least these three targets:

  • “MyPlugin - All”
  • “MyPlugin - Shared Code”
  • “MyPlugin - VST”

I guess you duplicated “MyPlugin - VST” to something like “MyPlugin - VST+IS_EQIP” and you set the preprocessor macro IS_EQIP to 1 on that target. However, your code is compiled as part of building “MyPlugin - Shared Code”, since the same logic will be reused for various plugin formats (VST, VST3, AU, AUv3, …).

You need to also duplicate “MyPlugin - Shared Code” to “My Plugin - Shared Code+IS_EQIP”, and make “My Plugin - VST+IS_EQIP” depend on it instead of the default shared target.


Thanks for the suggestion McMartin, but it doesn’t appear to be working.

When the duplicate VST is set to depend on the original Shared Code, I can enable the preprocessor macro in the original Shared Code and it works correctly in the duplicate VST. However, when I switch the duplicate VST’s dependence to the duplicate Shared Code, enabling/disabling the preprocessor macro in the duplicate Shared Code has no effect on the duplicate VST so it behaves as if the preprocessor macro is disabled.

I set the duplicate VST to depend on the duplicate Shared Code via Build Phases -> Target Dependencies. Are there any other settings I need to switch to set up that dependency?

Build Phases -> Target Dependencies only tells Xcode which target must be built before the current one. It doesn’t imply that the duplicate VST will use the binary produced by the duplicate Shared Code target.

In the Build Settings of the duplicate VST target, you need to change the setting Linking -> Other Linker Flags and replace -lMyPlugin by -lMyPlugin_IS_EQIP (or whatever the static library produced by the duplicate Shared Code target is called).

1 Like

That did it. Thanks, McMartin!