Configure Builds With CMake

Generate build files and compile a project with a modern out-of-source workflow.

LinuxpackagesbuildmakeLow risk
Run cmake -S . -B build then cmake --build build to configure and compile.

01Command

Command
$ cmake -S . -B build && cmake --build build

02What 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

RiskLow risk
Requirementssudo apt install cmake
!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

  • CMake
    Official project · vendor-doc · 2026-09-20
    Evidence: Debian packages CMake, the cross-platform build system generator.
  • Debian package: cmake
    Debian · vendor-doc · 2026-09-20
    Evidence: Debian packages CMake, the cross-platform build system generator.

Last verified: 2026-09-22 · Category: Developer

06Related solutions