# cmake\_install.cmake using wrong CMAKE\_INSTALL\_CONFIG\_NAME

**URL:** https://discourse.cmake.org/t/cmake-install-cmake-using-wrong-cmake-install-config-name/5545
**Category:** Usage
**Created:** [April 26, 2022, 2:20pm UTC](https://discourse.cmake.org/t/cmake-install-cmake-using-wrong-cmake-install-config-name/5545 "2022-04-26T14:20:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![janhieber](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@janhieber](https://discourse.cmake.org/u/janhieber)
#### Post date: [April 26, 2022, 2:20pm UTC](https://discourse.cmake.org/t/cmake-install-cmake-using-wrong-cmake-install-config-name/5545/1 "2022-04-26T14:20:42Z")

</div>

Hey,  
I use CMake 3.17.2 on Windows with the generator “Visual Studio 14 2015 Win64”.

When I create my project, CMake also creates the file `cmake_install.cmake`.  
This file contains the wrong default `CMAKE_INSTALL_CONFIG_NAME`. It is set to “Release” for me, but I create a “Debug” project. I can see from the (cryptic) source code that it should use `CMAKE_BUILD_TYPE` if nothing special is set.

This is how I call CMake:

```bash
cmake.exe -G "Visual Studio 14 2015 Win64"
  -DCMAKE_INSTALL_PREFIX=install
  -DCMAKE_TOOLCHAIN_FILE=HIDDEN/msbuild.cmake
  -DCMAKE_PREFIX_PATH=SOMEPATHS
  -DCMAKE_BUILD_TYPE=Debug
  -DBUILD_SHARED_LIBS=ON
  path/to/source

```

And the cmake\_install.cmake then contains:

```cmake
...
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
  if(BUILD_TYPE)
    string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
  else()
    set(CMAKE_INSTALL_CONFIG_NAME "Release")
  endif()
  message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
...

```

Can anyone tell me why this is the case and how I get a “Debug” as default?

---

<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: [April 26, 2022, 2:27pm UTC](https://discourse.cmake.org/t/cmake-install-cmake-using-wrong-cmake-install-config-name/5545/2 "2022-04-26T14:27:37Z")

</div>

> [@janhieber](#):
>
> `-DCMAKE_BUILD_TYPE=Debug`

This does nothing with the Visual Studio generator.

> [@janhieber](#):
>
> `set(CMAKE_INSTALL_CONFIG_NAME "Release")`

This comes from the first element of the `CMAKE_CONFIGURATIONS` list. Feel free to set its ordering as you see fit in your top-level `CMakeLists.txt` file.

---

<div class="post-metadata">

### Author: ![janhieber](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@janhieber](https://discourse.cmake.org/u/janhieber)
#### Post date: [April 26, 2022, 2:32pm UTC](https://discourse.cmake.org/t/cmake-install-cmake-using-wrong-cmake-install-config-name/5545/3 "2022-04-26T14:32:58Z")

</div>

> [@ben.boeckel](#):
>
> `CMAKE_CONFIGURATIONS`

Ahhhh, I set `CMAKE_CONFIGURATION_TYPES=Debug` and it works!  
Thank you very much!
