How to properly disable JUCE_COPY_PLUGIN_AFTER_BUILD?

I’m running into a frustrating issue I could use help with.

On my development systems, we want the plugins to be installed in place, for debugging/developing purposes (e.g., on MacOS, in ~/Libray/Audio/Plug-Ins/Components, etc.)

On the BUILDSERVER, we do not want to do any plugin copying, since the buildserver is only signing/notarizing/packaging the final product.

To accomplish this, I have in my CMakeLists.txt file, the following statements:

juce_add_plugin("${PROJECT_NAME}"
    COPY_PLUGIN_AFTER_BUILD TRUE
)

Followed shortly after with:

# Do not copy the plugin into standard directories if it is a Release build type
if (${CMAKE_BUILD_TYPE} MATCHES "Release")
	message(STATUS "Release build detected: will not copy plugins")
	set_target_properties("${PROJECT_NAME}" PROPERTIES JUCE_COPY_PLUGIN_AFTER_BUILD OFF)
else ()
	message(STATUS "Debug build detected: will copy plugins for testing")
	set_target_properties("${PROJECT_NAME}" PROPERTIES JUCE_COPY_PLUGIN_AFTER_BUILD ON)
endif()

But, this does not seem to be working. No matter what, the build server (which is for sure setting the CMAKE_BUILD_TYPE to “Release”) still attempts the copy.

How do I set this up properly? I think I’ve got some confusion about the applicability of the juce_add_plugin() statements, compared with the if … else … endif() statement which follows shortly after the plugin declaration.

EDIT: is the problem something like the difference between COPY_PLUGIN_AFTER_BUILD and JUCE_COPY_PLUGIN_AFTER_BUILD? Also, is it unwise to assume that TRUE=ON/FALSE=OFF?

Most of the properties that get set in juce_add_plugin are just used to pass target state through to nested functions, so changing these properties after the call may not have an effect.

I’d recommend omitting the COPY_PLUGIN_AFTER_BUILD option completely. Then, if you pass -D JUCE_COPY_PLUGIN_AFTER_BUILD=TRUE when configuring the project for local development, this will enable the copy behaviour globally. You can use CMakePresets.json to set up default options for local/CI builds. Another option would be to leave the property disabled, but to call juce_enable_copy_plugin_step() manually when the correct conditions are met.

1 Like

Ah, that adds some clarity to the issue, thank you @reuk. I will adjust things in the next few days and when I work it out, come back with some sample code for the purpose of future eyeballs with a similar requirement. Appreciate your input!