This is the second article on the basic skills of developing C++ projects using CMake. The first article can be found in the CMake Simple Tutorial.
1. Environment Configuration
First refer to Debugging and Running CMake Projects Using CMake Tool, and install the specified version of CMake and the CMake Tool extension.
2. Configure CMake Build Parameters
In actual large project development, most of the time when we compile CMake projects, there are a bunch of build parameters that need to be passed. We need to configure them in the settings file of VSCode.

Set “cmake.configureArgs” in settings.json, for example:

Next, set breakpoints in the editor and click the Debug button at the bottom of the editor to start debugging.

If you need to switch the debug target, press Command + Shift + P, search for CMake: Set Debug Target, and you can switch.
If you need to pass command line arguments, add “cmake.debugConfig” in settings.json.
