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 Variant
The same aforementioned build variant options should present themselves.