From 1d39710144f3563a62a6d451d3d7887f82e529f5 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 14 May 2020 11:40:09 +0100 Subject: [PATCH] CMake: Add -Wl,--no-undefined to linker flags on Linux Fixes an issue where VST3 plugins would appear to link successfully, but fail to load in hosts due to missing symbols. --- extras/Build/CMake/JUCEUtils.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index 80c55454bc..19530de4a8 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -1340,6 +1340,10 @@ function(_juce_link_plugin_wrapper shared_code_target kind) add_library(${target_name} MODULE) endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + target_link_libraries(${target_name} PRIVATE "-Wl,--no-undefined") + endif() + # We re-export the shared code's private include dirs, because the wrapper targets need to # see the module headers. We don't just link publicly, because that would introduce # conflicting macro definitions.