How to change "Applications" subfolder for "productbuild"


Is it possible to change the subfolder where components get installed to
with the productbuild CPack generator?
It always installs everything in “Applications”. I would like to at least bundle everything under “Applications/MySoftwareBundle” and store all my .apps there.
In a next step I maybe want to install some Preferences in the Preferences folder.
How do I do that?


I don’t know about ProductBuild, but the DragNDrop generator supported putting / in “application bundle names” to achieve this.

I found in the source code how to set an overall package prefix. The docs unfortunately do not mention any usage on macOS.

But since the install-location for each component is hardcoded,
you probably won’t be able to install different locations easily

I assume changing the prefix in-between install or cpack_component commands will not work.

CPACK_PACKAGING_INSTALL_PREFIX is a general setting that is documented as applying to all CPack generators. I don’t know if the productbuild generator has any special handling or caveats around that though.