How to change the active solution configuration of visual studio

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

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

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

Thank you for the fast answer.

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

I put this:

    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:

>>> 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

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

Hmm. That looks awfully alphabetical :confused: .

Lol! yes.

As I said before when using -DCMAKE_BUILD_TYPE=RelWithDebInfo I got the follwoing warning:

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?

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.