diff --git a/docs/CMake API.md b/docs/CMake API.md index d6e1594ff0..5b8b01147c 100644 --- a/docs/CMake API.md +++ b/docs/CMake API.md @@ -611,10 +611,11 @@ target!). juce_set_aax_sdk_path() juce_set_vst2_sdk_path() + juce_set_vst3_sdk_path() -Call these functions from your CMakeLists to set up your local AAX and/or VST2 SDKs. These functions -should be called *before* adding any targets that may depend on the AAX/VST2 SDKs (plugin -hosts, VST2/AAX plugins etc.). +Call these functions from your CMakeLists to set up your local AAX, VST2, and VST3 SDKs. These +functions should be called *before* adding any targets that may depend on the AAX/VST2/VST3 SDKs +(plugin hosts, AAX/VST2/VST3 plugins etc.). #### `juce_add_module` diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index d3046444e3..cb92d66fd9 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -564,8 +564,13 @@ function(juce_add_module module_path) if(${module_name} STREQUAL "juce_audio_processors") add_library(juce_vst3_headers INTERFACE) + + target_compile_definitions(juce_vst3_headers INTERFACE "$<$:JUCE_CUSTOM_VST3_SDK=1>") + target_include_directories(juce_vst3_headers INTERFACE - "${base_path}/juce_audio_processors/format_types/VST3_SDK") + "$<$:$>" + "$<$>:${base_path}/juce_audio_processors/format_types/VST3_SDK>") + target_link_libraries(juce_audio_processors INTERFACE juce_vst3_headers) if(JUCE_ARG_ALIAS_NAMESPACE) @@ -2350,6 +2355,22 @@ function(juce_set_vst2_sdk_path path) "${path}") endfunction() +function(juce_set_vst3_sdk_path path) + if(TARGET juce_vst3_sdk) + message(FATAL_ERROR "juce_set_vst3_sdk_path should only be called once") + endif() + + _juce_make_absolute(path) + + if(NOT EXISTS "${path}") + message(FATAL_ERROR "Could not find VST3 SDK at the specified path: ${path}") + endif() + + add_library(juce_vst3_sdk INTERFACE IMPORTED GLOBAL) + + target_include_directories(juce_vst3_sdk INTERFACE "${path}") +endfunction() + # ================================================================================================== function(juce_disable_default_flags)