CMake is a tool for defining and managing code builds across platforms. It uses CMakeLists.txt files and variables to describe builds and generate native build scripts. A simple "Hello World" project can be built with CMake by adding a main.cpp file and CMakeLists.txt that specifies the project, adds the source file to an executable target, and sets the minimum CMake version. CMake configurations like Debug and Release can be selected via the CMAKE_BUILD_TYPE variable or generator options. Out-of-source builds are recommended to separate source and build artifacts.