# VS multi-config: how to set different install dir for Release/Debug

**URL:** <https://discourse.cmake.org/t/vs-multi-config-how-to-set-different-install-dir-for-release-debug/7736>\
**Category:** Code\
**Created:** [March 21, 2023, 1:39pm UTC](https://discourse.cmake.org/t/vs-multi-config-how-to-set-different-install-dir-for-release-debug/7736 "2023-03-21T13:39:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ignus2](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ignus2/32/3075_2.png) [@ignus2](https://discourse.cmake.org/u/ignus2)\
**Post date:** [March 21, 2023, 1:39pm UTC](https://discourse.cmake.org/t/vs-multi-config-how-to-set-different-install-dir-for-release-debug/7736/1 "2023-03-21T13:39:10Z")

</div>

There’s a single variable `CMAKE_INSTALL_PREFIX` which controls the install location, but I’d like to install to separate locations depending on Release/Debug builds.  
I’m using multi-config VS generator.

The current workaround/hack I’m using is this:  
`cmake ... -DCMAKE_INSTALL_PREFIX=d:/install/${BUILD_TYPE}`  
which will cause the literal string “`d:/install/${BUILD_TYPE}`” (without variable expansion) to be embedded into the install scripts, which will get evaluated during install time, and will do the thing I’m looking for, but I have the feeling that this is just a hack, and I’m looking for a better approach (if there’s any).

---

<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:** [March 22, 2023, 12:20pm UTC](https://discourse.cmake.org/t/vs-multi-config-how-to-set-different-install-dir-for-release-debug/7736/2 "2023-03-22T12:20:35Z")

</div>

I don’t think there’s a mechanism for per-config install locations (and the prefix is certainly not config-aware either).

---

<div class="post-metadata">

**Author:** ![ignus2](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ignus2/32/3075_2.png) [@ignus2](https://discourse.cmake.org/u/ignus2)\
**Post date:** [March 23, 2023, 10:26am UTC](https://discourse.cmake.org/t/vs-multi-config-how-to-set-different-install-dir-for-release-debug/7736/3 "2023-03-23T10:26:41Z")

</div>

That’s unfortunate, regardless the work-around above is sufficient and works perfectly for us at this point.

---

<div class="post-metadata">

**Author:** ![JRR](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@JRR](https://discourse.cmake.org/u/JRR)\
**Post date:** [May 23, 2024, 8:28pm UTC](https://discourse.cmake.org/t/vs-multi-config-how-to-set-different-install-dir-for-release-debug/7736/4 "2024-05-23T20:28:47Z")

</div>

Any chance functionality like this could be added? I tried this using generator expressions which of course didn’t work (sadness ☹ )

---

<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:** [June 10, 2024, 12:56pm UTC](https://discourse.cmake.org/t/vs-multi-config-how-to-set-different-install-dir-for-release-debug/7736/5 "2024-06-10T12:56:11Z")

</div>

File a feature request.
