From 6688bbf08c026abc7662bde0e7606dbd4704d2f5 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 18 May 2020 22:19:58 +0100 Subject: [PATCH] CMake: Stop automatically linking juce_audio_plugin_client to plugin targets This change gives projects more flexibility to e.g. pre-build juce_audio_plugin_client into a staticlib and to reuse it in several targets. --- extras/Build/CMake/JUCEUtils.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index e5a184fd50..42295ba02d 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -471,7 +471,15 @@ function(juce_add_module module_path) OUT_PATH "${base_path}") endforeach() - list(APPEND all_module_sources "${base_path}/${module_name}/juce_audio_plugin_client_utils.cpp") + set(utils_source + "${base_path}/${module_name}/juce_audio_plugin_client_utils.cpp") + add_library(juce_audio_plugin_client_utils INTERFACE) + target_sources(juce_audio_plugin_client_utils INTERFACE "${utils_source}") + + if(JUCE_ARG_ALIAS_NAMESPACE) + add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_audio_plugin_client_utils + ALIAS juce_audio_plugin_client_utils) + endif() else() _juce_module_sources("${module_path}" "${base_path}" globbed_sources) list(APPEND all_module_sources ${globbed_sources}) @@ -1434,10 +1442,10 @@ function(_juce_configure_plugin_targets target) message(FATAL_ERROR "Plugin targets require CMake 3.15 or higher") endif() - target_link_libraries(${target} PRIVATE juce::juce_audio_plugin_client) - _juce_set_output_name(${target} $_SharedCode) + target_link_libraries(${target} PRIVATE juce::juce_audio_plugin_client_utils) + get_target_property(enabled_formats ${target} JUCE_FORMATS) if((VST IN_LIST enabled_formats) AND (NOT TARGET juce_vst2_sdk))