# How to change "Applications" subfolder for "productbuild"

**URL:** https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897
**Category:** Usage
**Created:** [November 17, 2022, 5:08pm UTC](https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897 "2022-11-17T17:08:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jpfeuffer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jpfeuffer/32/1529_2.png) [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)
#### Post date: [November 17, 2022, 5:08pm UTC](https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897/1 "2022-11-17T17:08:15Z")

</div>

Hi!

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?

Thanks!  
J

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 17, 2022, 6:35pm UTC](https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897/2 "2022-11-17T18:35:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jpfeuffer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jpfeuffer/32/1529_2.png) [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)
#### Post date: [November 18, 2022, 9:49am UTC](https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897/3 "2022-11-18T09:49:46Z")

</div>

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

> <https://github.com/Kitware/CMake/blob/c5a945dce8e1a4fb1b1db91c2dae03795c74074b/Source/CPack/cmCPackProductBuildGenerator.cxx#L121>

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

> <https://github.com/Kitware/CMake/blob/c5a945dce8e1a4fb1b1db91c2dae03795c74074b/Source/CPack/cmCPackProductBuildGenerator.cxx#L239>

I assume changing the prefix in-between install or cpack\_component commands will not work.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [November 18, 2022, 11:52pm UTC](https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897/4 "2022-11-18T23:52:28Z")

</div>

`CPACK_PACKAGING_INSTALL_PREFIX` is a general setting that [is documented](https://cmake.org/cmake/help/latest/variable/CPACK_PACKAGING_INSTALL_PREFIX.html) as applying to all CPack generators. I don’t know if the `productbuild` generator has any special handling or caveats around that though.
