CMake icon

CMake 4.4.4

CMake generates native build files from project descriptions and coordinates software builds across platforms. It includes CTest for test execution and CPack for packaging.

Updated October 2, 2026
37.3 MB
0.0

Use the arrow keys to choose a rating, then press Enter or Space to submit it.

Not rated yet 0 user ratings

App Specs

DeveloperKitware, Inc.
LicenseFreeware
CategoryUtilities
Available platformsWindows, macOS, Linux
Downloads8

Overview

CMake is a free, open-source toolset from Kitware for configuring, building, testing and packaging software on Windows, macOS and Linux. It reads project descriptions and generates files for native build tools, which compile and link the project. CMake uses the BSD 3-clause license and includes the CTest testing driver and CPack packaging tool.

Project descriptions become native builds

A project describes its source files, targets and dependencies in CMakeLists.txt files. You give CMake the source directory, a build directory and a generator. During configuration, it identifies compilers, tools and dependency locations. Generation then writes the rules for the chosen backend, such as Makefiles, Ninja, Visual Studio or Xcode.

The build directory holds the generated files and resulting executables or libraries. Several build directories can use the same source tree with different configurations. CMake’s build command invokes the appropriate native build tool and can select an individual target.

Generator Configuration choice
Makefiles or Ninja Choose Debug or Release during configuration
Visual Studio or Xcode Choose the configuration when building

Targets define the dependency graph

CMake organizes a build around targets: executables, libraries and custom operations. The project supplies each target’s source files and links it to the libraries it uses. CMake derives build order from those relationships and carries dependency information into the native build rules.

Target properties specify include directories, compiler options and preprocessor definitions. Private settings apply to the target itself, while interface settings apply to targets that use it. Public settings cover both. Custom commands can also run code generators during a build, with dependency rules controlling when their outputs become available.

Editing the build cache

CMake records configuration values in CMakeCache.txt inside the build directory. These values include compiler locations, dependency paths and project options. Command-line definitions change individual entries, while cmake-gui and the terminal-based ccmake provide interactive editors.

In the graphical editor, you choose source and build directories, configure the project and edit the resulting entries. Boolean entries use checkboxes; text and path entries provide their corresponding input controls. Reconfiguring applies the changes before CMake regenerates the build files. The project decides which optional components and switches appear.

Finding external packages

The find_package command lets a CMake project request a dependency, optionally specifying its version and components. CMake searches package configuration files or Find modules and returns imported targets or variables describing the dependency. A search-prefix setting points it toward development files outside standard locations. The project then uses that information when compiling and linking its own targets.

Building for another system

CMake normally detects the host’s compiler toolchain. For cross-compilation, a toolchain file supplies the target system, compiler paths and, where necessary, a target filesystem root. CMake reads that description before configuring the project. Compiler checks establish available capabilities, and the cache retains their results for subsequent configuration runs.

Presets for repeated work

CMake presets collect named settings in JSON files. A configure preset can specify the generator, build directory, cache values and environment. Selecting its name applies those settings, with individual overrides available afterward.

The project-wide presets file holds shared build details; a separate user file holds local choices. Presets can inherit settings from other presets. Build, test and package presets cover their respective operations. A workflow preset begins with configuration and continues through build, test or packaging steps.

Running the project’s tests

Projects register test commands through CMake, and CTest runs them from the build tree. You can select tests by name or label, choose a build configuration and control parallel execution. CTest reports outcomes and can show a failing test’s output. A JUnit XML export writes results for other testing tools. The project must define its tests before CTest can run them.

Preparing a distributable

CMake projects can define installation rules for executables, libraries, headers and other files. Those rules specify the destination layout, with an installation prefix controlling its location.

CPack uses the project’s packaging configuration to create installers or source packages. You choose a package generator and output directory, and its backend invokes the relevant packaging tools. Available formats depend on the platform and its tools. For multi-configuration builds, CPack also takes a configuration choice to identify which built artifacts belong in the package.

Key Features

  • Native build generation
  • Target dependency management
  • Interactive cache configuration
  • Package discovery
  • Cross-compilation toolchains
  • JSON build presets
  • CTest test execution
  • CPack installer generation

Similar Apps