Set different PLUGIN_CODE for the targets?

Is it possible to set a different PLUGIN_CODE on one of the target when adding them to the juce_add_plugin cmake function?

I would like (because of backward compability reasons) to have one PLUGIN_CODE for AU and another, different code, for the VST VST3 AAX targets

No, this isn’t directly possible. I’d recommend calling juce_add_plugin twice, once for your AU target and again for the VST/VST3/AAX targets. You could also put all the common stuff in a function to reduce duplication.

If I call juce_add_plugin twice. once for all except AU and then once again with only AU.
I get the cmake error:
add_library cannot create target “PluginName” because another
target with the same name already exists. The existing target is a static
library created in source directory

cmake 3.21.4 and xcode

Yes, you’ll need to pick a different target name each time.

I added a postbuild step that change the AU subtype in the Info.plist :

add_custom_command(TARGET ${PLUGIN_NAME}_AU COMMAND /usr/libexec/PlistBuddy -c "Set AudioComponents:0:subtype ${PLUGIN_CONFIG_CODE_AU}" "${AU_PLIST_PATH}/Info.plist"