# Problem specifying Install Prefix

**URL:** https://discourse.cmake.org/t/problem-specifying-install-prefix/12897
**Category:** Code
**Created:** [November 5, 2024, 9:32am UTC](https://discourse.cmake.org/t/problem-specifying-install-prefix/12897 "2024-11-05T09:32:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![perdrix](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/a8b319/32.png) [@perdrix](https://discourse.cmake.org/u/perdrix)
#### Post date: [November 5, 2024, 9:32am UTC](https://discourse.cmake.org/t/problem-specifying-install-prefix/12897/1 "2024-11-05T09:32:55Z")

</div>

I wrote:

```auto
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>)
message ("Install prefix set to: " ${CMAKE_INSTALL_PREFIX})

```

Which reported:

```auto
Install prefix set to: C:/Users/amonra/Documents/GitHub/DSS/x64/$<CONFIG>

```

Whereas I expected:

```auto
Install prefix set to: C:/Users/amonra/Documents/GitHub/DSS/x64/Debug

```

What am I doing wrong please?

David

---

<div class="post-metadata">

### Author: ![retif](https://discourse.cmake.org/user_avatar/discourse.cmake.org/retif/32/1776_2.png) [@retif](https://discourse.cmake.org/u/retif)
#### Post date: [November 5, 2024, 9:59am UTC](https://discourse.cmake.org/t/problem-specifying-install-prefix/12897/2 "2024-11-05T09:59:47Z")

</div>

From what I remember, you can not use `$<CONFIG>` like that, as this is a [generator expression](https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:CONFIG), so it doesn’t get evaluated at that stage. You probably should use [CMAKE\_BUILD\_TYPE](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) instead, but that will work only with single-config generators (_such as Ninja_); while with multi-config generators (_such as Visual Studio_) it will be either empty or some auto-detected default value, so it isn’t reliable (_unless you provide it with `-D` or environment variable_).

---

<div class="post-metadata">

### Author: ![perdrix](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/a8b319/32.png) [@perdrix](https://discourse.cmake.org/u/perdrix)
#### Post date: [November 5, 2024, 5:35pm UTC](https://discourse.cmake.org/t/problem-specifying-install-prefix/12897/3 "2024-11-05T17:35:05Z")

</div>

Using CMAKE\_BUILD\_TYPE seemed to work OK, I added some code to catch the case where it isn’t set.

Thanks, David
