# Building plugin installers with CPack productbuild generator

**URL:** <https://forum.juce.com/t/building-plugin-installers-with-cpack-productbuild-generator/55832>\
**Category:** CMake\
**Created:** [April 17, 2023, 9:38pm UTC](https://forum.juce.com/t/building-plugin-installers-with-cpack-productbuild-generator/55832 "2023-04-17T21:38:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [April 17, 2023, 9:38pm UTC](https://forum.juce.com/t/building-plugin-installers-with-cpack-productbuild-generator/55832/1 "2023-04-17T21:38:00Z")

</div>

I’m trying to set up CPack for building my plugin installers (with CPack’s `productbuild` generator, to generate a `.pkg` package on Mac).

I’m calling the install commands with relative paths in my cmakelists like this:

```plaintext
install (TARGETS MyVST3
         DESTINATION "Library/Audio/Plug-Ins/VST3"
         COMPONENT MyVST3)

install (TARGETS MyAU
         DESTINATION "Library/Audio/Plug-Ins/Components"
         COMPONENT MyAU)

```

and then after I build the `.pkg`, it appears to be prepending `Applications/` to the payload paths – it displays the destination paths as `./Applications/Library/Audio/Plug-Ins/VST3/` and `./Applications/Library/Audio/Plug-Ins/Components/`

Is this just a property of CPack’s `productbuild` generator, does it automatically prepend `Applications/` to all destination paths?

---

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [April 17, 2023, 9:47pm UTC](https://forum.juce.com/t/building-plugin-installers-with-cpack-productbuild-generator/55832/2 "2023-04-17T21:47:27Z")

</div>

hmm, it seems that if I set `CPACK_PACKAGING_INSTALL_PREFIX` to `"/"` in my cmakelists, this prevents `Applications/` from being prepended to all the destination paths.

---

<div class="post-metadata">

**Author:** ![pixout](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pixout/32/10969_2.png) [@pixout](https://forum.juce.com/u/pixout)\
**Post date:** [December 18, 2023, 10:25am UTC](https://forum.juce.com/t/building-plugin-installers-with-cpack-productbuild-generator/55832/3 "2023-12-18T10:25:35Z")

</div>

After four days of googling and experiments with CPacks variables, I have found the combination that’s works on Cpack 3.25.1 under MacOS 14.1.2

```auto

install(
    DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Project_artefacts/${CMAKE_BUILD_TYPE}/VST3/Project.vst3
    DESTINATION Library/Audio/Plug-Ins/VST3
    USE_SOURCE_PERMISSIONS
    COMPONENT VST3
)

install(
    DIRECTORY ${CMAKE_SOURCE_DIR}/Assets
    DESTINATION "Library/Application Support/Project/${PROJECT_NAME}/Assets"
    COMPONENT ASSETS
)

IF (CPACK_GENERATOR MATCHES "productbuild") 
  
set(CPACK_MONOLITHIC_INSTALL OFF)
set(CPACK_COMPONENTS_ALL VST3 ASSETS)

set(CPACK_COMPONENT_VST3_REQUIRED TRUE)
set(CPACK_COMPONENT_ASSETS_REQUIRED TRUE)

set(CPACK_PACKAGING_INSTALL_PREFIX "/")
set(CPACK_PACKAGE_VENDOR "Company") 
 
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}) 
set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/Installer/welcome.txt) 
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/Installer/readme.txt) 
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/Installer/license.txt)
 
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "FALSE") 
 
ENDIF()

```
