cmake describes itself as a way to build, test, and package software. Software like this is needed because compiling larger C++ projects quickly becomes a complicated affair, and no one wants to re-type long compile commands, or rebuild parts of the program that don't need to be rebuilt. People also don't want to write makefiles by hand for many of the same reasons.
You will need to download and install cmake, and if you're on Windows, a reboot for good measure.
Actually using cmake to simply build your project does assume that you have a proper C++ environment already installed. From a terminal, you can navigate to the project's root directory and issue the following commands.
cmake -B build -S .
cmake --build build
The first command will create a build directory called build
where cmake will store its cache and create a build solution according to your C++ environment. We want to keep cmake output separate from the source as it's a lot cleaner from a directory tree or general organization standpoint. The same CMakeLists.txt file can create a makefile for Linux/Mac users, a VS solution for pure Visual Studio, an XCode solution for Mac, etc. CMakeLists.txt describes how the program should be built, and cmake will create the actual build instructions for you.
The second command will actually compile and link your code.
As mentioned in the comments, VS Code offers a cmake extension. It should detect your 'kit' (C++ environment) automatically, but if it doesn't it can be configured accordingly. Building is then a click away. By default, it does create a new directory to store build files and artifacts.
cmake documentation can be a bear to go through, but I have found this to be a great reference for basic usage.