Configure Builds With CMake
Generate build files and compile a project with a modern out-of-source workflow.
Run cmake -S . -B build then cmake --build build to configure and compile.
01Command
Command
$ cmake -S . -B build && cmake --build build02What it does
CMake reads CMakeLists.txt and generates native build files for Make, Ninja or IDE generators. The -S/-B flags keep source and build separate, and cmake --build invokes the selected generator, so the same commands work across platforms.
03Risk
!Warning: Generated caches hold absolute paths; delete the build directory rather than copying it between machines.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- CMakeEvidence: Debian packages CMake, the cross-platform build system generator.
- Debian package: cmakeEvidence: Debian packages CMake, the cross-platform build system generator.
Last verified: 2026-09-22 · Category: Developer