Building plugin installers with CPack productbuild generator

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:

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?

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.

2 Likes

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


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()
2 Likes