Icon.icns file installs as sibling to plugin bundle

Hi there,

Is it possible to have _juce_generate_icon omit installing the Icon.icns file for plugin formats .component/.vst3 to the “…/JuceLibraryCode/Icon.icns” location ? I’m unaware of any daw that makes use of these.

Alternatively, could it install to another location that does not cause the following issue:

When using CPack generator productbuild to build a .pkg installer on macos, the following command incorrectly installs the Icon.icns as a sibling file to the .component or .vst3 bundle. At the same time, it correctly installs another copy of Icon.icns file as a child file to the bundle subdirectory “Contents/Resource”.

Command:
            install(
                TARGETS ${target}
                CONFIGURATIONS Release
                DESTINATION ${destination} # E.g. Library/Audio/Plug-Ins/Components or VST3
                COMPONENT ${component}
            )
Output:
CPack: -   Install component: AU
CPack Verbose: Install configuration: "Release"
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/_CodeSignature
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/_CodeSignature/CodeResources
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/MacOS
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/MacOS/Multisamplor
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/Resources
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/Resources/Icon.icns
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/Info.plist
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Multisamplor.component/Contents/PkgInfo
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/AU/Library/Audio/Plug-Ins/Components/Icon.icns
CPack: -   Install component: VST3
CPack Verbose: Install configuration: "Release"
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/_CodeSignature
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/_CodeSignature/CodeResources
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/MacOS
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/MacOS/Multisamplor
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/Resources
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/Resources/Icon.icns
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/Resources/moduleinfo.json
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/Info.plist
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Multisamplor.vst3/Contents/PkgInfo
CPack Verbose: Installing: /Users/xxx/xcode-macos-pkg/app/multisamplor/_CPack_Packages/Darwin/productbuild/Multisamplor_1.0.0/VST3/Library/Audio/Plug-Ins/VST3/Icon.icns

I found the workaround to be the following install() command, but since there is a RESOURCE target property, CMake will complain that there is a RESOURCE but no RESOURCE DESTINATION. But when you specify a RESOURCE DESTINATION, it overrides the BUNDLE and LIBRARY destination options (i.e. the bundle will only contain the Icon.icns). This is why i have to supplement the install() command with the following commands that temporarily remove the RESOURCE, call install(), then reinstate the RESOURCE:

            get_target_property(resource ${target} RESOURCE)
            set_target_properties(${target} PROPERTIES RESOURCE "")
            message(DEBUG "Removing RESOURCE=${resource} from ${target} to avoid warning...")
            install(
                TARGETS ${target}
                CONFIGURATIONS Release
                BUNDLE DESTINATION ${destination}
                LIBRARY DESTINATION ${destination}
                COMPONENT ${component}
            )
            set_target_properties(${target} PROPERTIES RESOURCE ${resource})

The above message() command will output the debug log:

--   Removing RESOURCE=/Users/xxx/xcode-macos-pkg/app/multisamplor/multisamplor_artefacts/JuceLibraryCode/Icon.icns from multisamplor_VST3 to avoid warning...

If you need more, let me know.
Thanks