# CMake: the build system generator behind most C and C++ projects

> CMake does not compile your code. It reads a CMakeLists.txt and writes the files another build tool needs. Here is what that means for installs, first builds and the cases where it gets in the way.

**Kitware/CMake** — Mirror of CMake upstream repository

- Repository: https://github.com/Kitware/CMake
- Website: https://gitlab.kitware.com/cmake/cmake
- Stars: 8,105 · Forks: 2,703
- Language: C
- License: BSD-3-Clause
- Published: 2026-09-22 · Updated: 2026-09-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/kitware-cmake

## What CMake solves, and who ends up using it

A C or C++ project has to be built by something: make, Ninja, MSBuild, Xcode, and each of those wants its own input files. Writing and maintaining one set per tool is the problem CMake addresses. The README calls it a cross-platform, open-source build system generator, and the word generator is the whole point. You describe the project once in CMakeLists.txt, and CMake writes the native build files for whichever generator you selected. The audience is anyone shipping C or C++ code to more than one machine. The README lists Microsoft Windows, Apple macOS, Linux, FreeBSD, OpenBSD, Solaris and AIX as supported platforms, and notes that other UNIX-like systems may work out of the box. That list is the reason the project exists. A single-platform codebase on one developer's laptop gains less from it.

## The configure and generate step, and why it is two steps

Running CMake on a source tree does not compile anything. It reads the top-level CMakeLists.txt, which in this repository sits next to the bootstrap script, and evaluates the project's declarations: the targets, the source files, the dependencies, the options. The output is a build directory holding files for the chosen generator. Only then does the native tool run. The repository layout reflects this split. CMakeLists.txt describes the project, Modules/ holds the find modules that locate external dependencies, and Help/ holds the documentation sources. A find_package call is resolved at configure time against those modules or against a package config file the dependency installed. That is why a missing dependency fails before any compiler runs, and why a stale build directory can keep an old configuration after the CMakeLists.txt changes. The two-step design is also what makes cross-compilation tractable: the generator is chosen at configure time, so the same source tree can produce MSBuild files on one run and makefiles on another.

## Installing CMake and running a first build

There are two documented routes. On Windows the README points at a binary release from the CMake download page, then says to proceed with the normal build instructions. On UNIX, macOS, MinGW, MSYS and Cygwin, you bootstrap from source with a C++11 compiler and make. The README gives this example for a plain build and install:

```bash
$ ./bootstrap && make && sudo make install
```

If you intend to develop CMake itself or run the test suite, the README recommends a separate build tree instead:

```bash
$ mkdir build && cd build
$ ../bootstrap && make
```

By default bootstrap vendors its dependencies, with one exception the README calls out explicitly: CMake does not vendor OpenSSL. In a minimal environment you disable it:

```bash
$ ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF
```

Under MSYS2 on Windows, the README lists the build tools to install before bootstrapping:

```bash
$ pacman -S --needed git base-devel mingw-w64-x86_64-gcc
```

To test a build, run ctest in the build directory after building. For documentation, configure with -DSPHINX_HTML=ON or -DSPHINX_MAN=ON, and add -DSPHINX_EXECUTABLE=/path/to/sphinx-build if Sphinx is not found automatically. Once CMake is installed, the normal workflow is to point it at a project's source directory and let it write build files into a separate directory, then invoke the generated build tool from there.

## Where CMake is the wrong tool

The generator model costs you a layer. If your project is a few source files built by one person on one machine, a direct make invocation or a compiler command line is shorter than a CMakeLists.txt plus a build directory, and there is no configure step to go wrong. CMake also does not replace your compiler: it locates and drives one, so a question about CMake versus GCC is really a question about two different layers of the stack. The README names no compiler requirement beyond C++11 for building CMake itself. Dependency resolution is the other sharp edge. Because find_package runs at configure time, a dependency that does not install a package config, or whose config lives somewhere the module search does not look, fails before compilation starts, and the error surfaces as a configure failure rather than a link error. The README does not document rollback or a way to undo an install, so treat the install prefix as a decision worth making deliberately. Finally, the bootstrap path assumes a working toolchain: it needs a C++11 compiler and make before CMake exists, which is exactly the situation a source build is meant to escape.

## CMake against hand-written makefiles and Meson

The comparison people search for is CMake versus make, and it is a category error worth stating plainly. Make is a build tool that reads makefiles and runs commands. CMake is a generator that writes those makefiles, or Ninja files, or Visual Studio project files, from a project description. Using both is normal: CMake configures, make builds. The real alternative is a different generator with a different description language. Meson takes a declarative Python-like DSL and is generally paired with Ninja, while CMake has its own command language and a much longer history of package configs published by third-party libraries. That history matters at find_package time: a library that ships a CMake package config is found with one call, and a library that does not forces you to write a find module or vendor the dependency. The trade-off runs the other way for build speed and language simplicity, where Meson's model is easier to read. The repository also ships CTest, the test runner the README invokes with ctest, which is a reason projects already using CMake keep testing inside it.

## Maintenance, releases and the BSD 3-clause licence

CMake is not archived, and the last push to this mirror was on 2026-09-21. Recent releases include v4.3.5 and v4.2.8 on 2026-09-04 and v4.4.3 on 2026-08-25, so maintenance branches and a newer line are being published in parallel. That parallel release pattern is the upgrade cost you should plan for. A project that sets a minimum required version in its CMakeLists.txt inherits a compatibility promise from whatever that version documents, and the repository is large: Modules/, Source/, Tests/, Utilities/ and Help/ are all top-level entries, and the Help/ tree is the documentation source that the Sphinx options build. Upgrading CMake itself is cheap on the binary route and expensive on the bootstrap route, since a source build recompiles the whole tree. The licence is the OSI-approved BSD 3-clause License, with the text in LICENSE.rst; the README states this plainly, and it is a permissive licence, but what that means for your distribution is a question for your own legal review.

## Conclusion

Adopt CMake if your project has to build on more than one platform or more than one compiler, or if it consumes libraries that ship a CMake package config. Do not adopt it if your build is a handful of files on one machine, since the configure step and the CMakeLists.txt add a layer that a direct make invocation does not have. Before committing, verify that the version you plan to require is available on your oldest supported platform, and check whether the libraries you depend on export a package a find_package call can locate. The README itself documents only two ways in: a binary release from the download page, or the bootstrap script in the source tree.

## FAQ

### What is CMake and why is it used?

CMake is a cross-platform, open-source build system generator, maintained and supported by Kitware. It is used so that one project description can produce native build files for Windows, macOS, Linux, FreeBSD, OpenBSD, Solaris and AIX instead of one hand-written build file per tool.

### Is CMake for C or C++?

The README does not restrict CMake to either language. It describes CMake as a build system generator and lists supported platforms rather than languages, and the requirement it states for building CMake itself is a C++11 compiler.

### What is CMake vs. GCC?

They sit at different layers. GCC is a compiler, while CMake is a generator that writes build files and then drives a toolchain. The README names no compiler requirement beyond C++11 for building CMake from source.

### What language is CMake written in?

The repository is listed with C as its primary language, and the source tree is bootstrapped and built from C++ sources. The README requires a C++11 compiler and make to run the bootstrap script.

### How do I install CMake on Ubuntu?

The README documents the source route for UNIX-like systems: run ./bootstrap, then make, then sudo make install, optionally with --prefix to set the install directory. It also notes that CMake does not vendor OpenSSL, so a minimal environment can bootstrap with -DCMAKE_USE_OPENSSL=OFF.

### How do I get a binary release of CMake for Windows?

The README says to download and install a binary release from the CMake download page, then build with an already-installed CMake using your preferred generator and options. It names MSVC from VS 2015 or later as one option, and MSYS2 with mingw-w64-x86_64-gcc as the other.

## Sources

- [Kitware/CMake on GitHub](https://github.com/Kitware/CMake)
- [License: BSD-3-Clause](https://github.com/Kitware/CMake/blob/master/LICENSE)
- [Project website](https://gitlab.kitware.com/cmake/cmake)
- [README](https://github.com/Kitware/CMake/blob/master/README.md)
- [Releases](https://github.com/Kitware/CMake/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/kitware-cmake
