CMake is a tool to help running C++ files on multiple platforms (terminal, VSCode, different OS, etc.). It gathers configuration information (similar to launch.json/tasks.json in VSCode) such as dependencies in a CMakeLists.txt.
mkdir -p build cd build cmake .. cmake --build . ./main
During compilation, C++ creates binary files that are specific to the OS i.e. the same source code will compile differently on macOS/Windows.
Linking is part of the build and attaches the required libraries.