I'm using the CMake Tools extension in VSCode to build and run a C++ project on Windows.
Where do I set if the build configuration should be Debug or Release?
On Build, CMake Tools executes
"C:\Program Files\CMake\bin\cmake.EXE" --build c:/work/foobar/build --config Debug --target ALL_BUILD
How do I get the extension to build with --config Release?
The CMake Tools extension sets up a lot of goodies, including a status bar panel for configuring various aspects of your build(s). In the status line various panels provided by VSCode and extensions can be enabled/disabled. And example including the CMake Tools mini panels appears below:

Note: I am not running VS Code on a Windows machine; mine is MacOS, but the premise is the same.
Anyway, if you click on the portion that says CMake: [Debug]: Ready a select-variant list should open near the top of the IDE in the location you're probably familiar seeing the general Command Palette open. It will look like this:

It is here you can change your selection from one build configuration type to another.
You can also do this via the main command palette by doing the following:
CMake. The list should filter to just CMake command options.CMake: Select VariantThe same aforementioned build variant options should present themselves.
For information, the CMake Tools extension status bar is now hidden by default. To show the status bar as mentioned in the other comment, do the following:
Extensions (Ctrl+Shift+X)
CMake Tools > Extension Settings
Search for "Status bar visibility" > select "visible"

Et voilà ! The status bar should appear at the bottom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With