Home

CMake

CMake is an open-source, cross-platform family of build-system generators. It is not a build system itself but a meta-build system that generates native build files for various environments, such as Make, Ninja, Visual Studio, and Xcode, from a common description file called CMakeLists.txt. This approach enables the same project to be built on many platforms with minimal changes.

CMake describes projects using its own scripting language. A typical CMakeLists.txt specifies project name, target sources,

Key features include support for multiple programming languages (such as C, C++, Fortran, CUDA), and a variety

Usage typically involves creating a CMakeLists.txt that describes the project, configuring the build with cmake -S

libraries,
include
directories,
compile
options,
and
installation
rules
through
commands
like
project,
add_executable,
add_library,
target_link_libraries,
and
install.
It
supports
out-of-source
builds,
where
the
build
artifacts
live
outside
the
source
tree,
and
uses
a
cache
to
store
configuration
results.
Dependency
management
features
include
find_package,
as
well
as
integration
with
FetchContent
and
ExternalProject
for
pulling
and
building
external
libraries.
of
platforms
and
compilers.
CMake
provides
generators
for
different
toolchains
and
IDEs,
enabling
multi-config
environments
like
Visual
Studio
and
Xcode,
as
well
as
single-config
environments
like
Make
or
Ninja.
The
ecosystem
includes
CTest
for
testing
and
CPack
for
packaging,
along
with
tooling
such
as
cmake-gui
and
ccmake
for
configuring
projects.
source
-B
build,
and
then
building
with
cmake
--build
build.
The
generated
project
or
Makefiles
can
then
be
used
with
the
native
build
system.
CMake
was
developed
by
Kitware
and
is
distributed
under
a
BSD-style
license,
with
widespread
adoption
in
both
open-source
and
commercial
software.