# How to change the active solution configuration of visual studio

**URL:** <https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [September 21, 2022, 1:13pm UTC](https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541 "2022-09-21T13:13:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![msilvestre](https://discourse.cmake.org/user_avatar/discourse.cmake.org/msilvestre/32/2666_2.png) [@msilvestre](https://discourse.cmake.org/u/msilvestre)\
**Post date:** [September 21, 2022, 1:13pm UTC](https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541/1 "2022-09-21T13:13:12Z")

</div>

Hi there,

I’ve searched for this but didn’t find the solution.

Is there any way of changing the active solution configuration of visual studio?  
 ![image](https://discourse.cmake.org/uploads/default/original/2X/8/8952faa535685650f202c6422103caa773aaa3e6.png)

When I open the visual studio solution I want to have RelWithDebugInfo active instead of Debug.  
I’ve tried the CMAKE\_BUILD\_TYPE var but it is ignored when using ‘Visual Studio 16 2019 generator’ (at least)

Thank you

---

<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:** [September 21, 2022, 1:18pm UTC](https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541/2 "2022-09-21T13:18:52Z")

</div>

You can change the order of the items in `CMAKE_CONFIGURATION_TYPES`. The first one is the “default” in the IDE.

---

<div class="post-metadata">

**Author:** ![msilvestre](https://discourse.cmake.org/user_avatar/discourse.cmake.org/msilvestre/32/2666_2.png) [@msilvestre](https://discourse.cmake.org/u/msilvestre)\
**Post date:** [September 21, 2022, 1:54pm UTC](https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541/3 "2022-09-21T13:54:07Z")

</div>

Thank you for the fast answer.

However it seems that it didn’t work for visual studio.

I put this:

```cmake
    message(">>> ${CMAKE_CONFIGURATION_TYPES}")
    list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES "RelWithDebInfo")
    message(">>>2 ${CMAKE_CONFIGURATION_TYPES}")
    list(PREPEND CMAKE_CONFIGURATION_TYPES "RelWithDebInfo")
    message(">>>3 ${CMAKE_CONFIGURATION_TYPES}")

```

And I got the following output:

```nohighlight
>>> Debug;Release;MinSizeRel;RelWithDebInfo
>>>2 Debug;Release;MinSizeRel
>>>3 RelWithDebInfo;Debug;Release;MinSizeRel

```

I deleted my build folder and recreate everything from scratch and When I open the VS I have the same thing:

![image](https://discourse.cmake.org/uploads/default/original/2X/6/6f59026658cc812e97ed710782800dcc4af63df5.png)

Am I doing something wrong? Or missing something?  
Thank you

---

<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:** [September 21, 2022, 8:09pm UTC](https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541/4 "2022-09-21T20:09:28Z")

</div>

Hmm. That looks awfully alphabetical 😕 .

---

<div class="post-metadata">

**Author:** ![msilvestre](https://discourse.cmake.org/user_avatar/discourse.cmake.org/msilvestre/32/2666_2.png) [@msilvestre](https://discourse.cmake.org/u/msilvestre)\
**Post date:** [September 22, 2022, 9:36am UTC](https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541/5 "2022-09-22T09:36:45Z")

</div>

Lol! yes.

As I said before when using -DCMAKE\_BUILD\_TYPE=RelWithDebInfo I got the follwoing warning:

```nohighlight
CMake Warning:
  Manually-specified variables were not used by the project:
                                                            
    CMAKE_BUILD_TYPE                                        

```

Is there any other way? Or this simply can’t be done using cmake?

---

<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:** [September 22, 2022, 12:25pm UTC](https://discourse.cmake.org/t/how-to-change-the-active-solution-configuration-of-visual-studio/6541/6 "2022-09-22T12:25:40Z")

</div>

`CMAKE_BUILD_TYPE` only affects single-config generators and VIsual Studio is not one of them. There’s probably some way to control it, but CMake doesn’t expose an option. I suggest filing [an issue](https://gitlab.kitware.com/cmake/cmake/-/issues).
