[CMake](https://cmake.org), the cross-platform, open-source build system.
  • C 39.6%
  • C++ 30%
  • CMake 27.5%
  • Roff 0.6%
  • Shell 0.5%
  • Other 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-10 00:05:30 -04:00
.devcontainer devcontainer: Add ast-grep 2026-09-29 08:07:50 -04:00
.github
.gitlab Merge topic 'sycl-language' 2026-10-09 08:49:00 -04:00
Auxiliary Ninja, Makefile: Add compile and link wrapper usage requirements 2026-09-30 07:51:22 -04:00
Help Merge topic 'sycl-language' 2026-10-09 08:49:00 -04:00
Licenses
Modules Merge topic 'sycl-language' 2026-10-09 08:49:00 -04:00
Packaging cmake-gui: Refactor installation into CMake.app/Contents on macOS 2025-10-31 09:33:52 -04:00
Source CMake Nightly Date Stamp 2026-10-10 00:05:30 -04:00
Templates SYCL: Initial language implementation 2026-10-07 11:43:31 -04:00
Tests Merge topic 'sycl-language' 2026-10-09 08:49:00 -04:00
Utilities Merge topic 'update-libuv' 2026-10-08 10:38:59 -04:00
.clang-format clang-format: Fix order of QCmake* includes 2026-03-05 13:50:48 -05:00
.clang-tidy clang-tidy: enable concatenation to cmStrCat check 2026-09-23 14:06:41 -04:00
.codespellrc cmake -E: Add CLI argument spell checking 2026-09-11 08:23:37 -04:00
.editorconfig
.git-remote-files update-third-party: sync with upstream 2026-01-22 15:30:28 -05:00
.gitattributes bindexplib: Export the same symbols on every host 2026-09-30 02:45:08 +02:00
.gitignore
.gitlab-ci.yml ci: Add jobs testing Clang on Windows without a VS developer environment 2026-10-02 15:08:20 -04:00
.hooks-config
.pre-commit-config.yaml ci(pre-commit): version bump typos hook + fix found typos 2026-08-29 05:26:37 +04:00
.pvsconfig pvs-studio: (V522) Prevent possible null-pointer dereference in RemoveRPathELF 2026-06-17 10:13:12 -04:00
.typos.toml pre-commit: Add tutorial exceptions for IDs and typos 1.48.0 2026-07-07 14:50:06 -04:00
bootstrap Ninja, Makefile: Add compile and link wrapper usage requirements 2026-09-30 07:51:22 -04:00
cmake_uninstall.cmake.in
CMakeCPack.cmake cmake-gui: Refactor installation into CMake.app/Contents on macOS 2025-10-31 09:33:52 -04:00
CMakeCPackOptions.cmake.in cmake-gui: Refactor installation into CMake.app/Contents on macOS 2025-10-31 09:33:52 -04:00
CMakeGraphVizOptions.cmake
CMakeLists.txt ci: Collect instrumentation processMetrics for CMake itself in CI 2026-10-05 14:35:22 -04:00
CompileFlags.cmake Linux: Do not force 64-bit time_t on 32-bit archs with system libarchive 2025-12-11 14:40:48 -05:00
configure
CONTRIBUTING.rst devcontainer: Add a Dev Container definition for CMake development 2026-09-08 16:23:33 +00:00
CONTRIBUTORS.rst CONTRIBUTORS: Add Qualcomm Technologies 2026-03-18 17:46:47 +00:00
CTestConfig.cmake
CTestCustom.cmake.in Tests/Instrumentation: Split make cases out to separate suite 2026-07-30 11:14:48 -04:00
DartConfig.cmake
LICENSE.rst CMake Nightly Date Stamp 2026-01-01 00:06:14 -05:00
README.rst Help/dev: Document use of sphinx-copybutton 2026-08-21 09:43:48 -04:00
sgconfig.yml ast-grep: add a rule to find adjacent string literals in cmStrCat calls 2025-05-15 19:11:11 +02:00

CMake
*****

Introduction
============

CMake is a cross-platform, open-source build system generator.
For full documentation visit the `CMake Home Page`_ and the
`CMake Documentation Page`_. The `CMake Community Wiki`_ also
references useful guides and recipes.

.. _`CMake Home Page`: https://cmake.org
.. _`CMake Documentation Page`: https://cmake.org/documentation
.. _`CMake Community Wiki`: https://gitlab.kitware.com/cmake/community/-/wikis/home

CMake is maintained and supported by `Kitware`_ and developed in
collaboration with a productive community of contributors.

.. _`Kitware`: https://www.kitware.com/cmake

License
=======

CMake is distributed under the OSI-approved BSD 3-clause License.
See `LICENSE.rst`_ for details.

.. _`LICENSE.rst`: LICENSE.rst

Building CMake
==============

Supported Platforms
-------------------

* Microsoft Windows
* Apple macOS
* Linux
* FreeBSD
* OpenBSD
* Solaris
* AIX

Other UNIX-like operating systems may work too out of the box, if not
it should not be a major problem to port CMake to this platform.
Please post to the `CMake Discourse Forum`_ to ask if others have
had experience with the platform.

.. _`CMake Discourse Forum`: https://discourse.cmake.org

Building CMake with CMake
-------------------------

You can build CMake as any other project with a CMake-based build system:
run an already-installed CMake on this source tree with your preferred
generator and options.  Then build it and install it.

To build the documentation, install `Sphinx`_ and configure CMake with
``-DSPHINX_HTML=ON`` and/or ``-DSPHINX_MAN=ON`` to enable the "html" or
"man" builder.  Add ``-DSPHINX_EXECUTABLE=/path/to/sphinx-build`` if the
tool is not found automatically.  See the `CMake Documentation Guide`_ for
details.

To run the test suite, run ``ctest`` in the CMake build directory after
building.  See the `CMake Testing Guide`_ for details.

.. _`Sphinx`: https://sphinx-doc.org
.. _`CMake Documentation Guide`: Help/dev/documentation.rst
.. _`CMake Testing Guide`: Help/dev/testing.rst

Building CMake from Scratch
---------------------------

UNIX/Mac OSX/MinGW/MSYS/Cygwin
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You need to have a C++ compiler (supporting C++11) and a ``make`` installed.
Run the ``bootstrap`` script you find in the source directory of CMake.
You can use the ``--help`` option to see the supported options.
You may use the ``--prefix=<install_prefix>`` option to specify a custom
installation directory for CMake.  Once this has finished successfully,
run ``make`` and ``make install``.

For example, if you simply want to build and install CMake from source,
you can build directly in the source tree::

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

Or, if you plan to develop CMake or otherwise run the test suite, create
a separate build tree::

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

By default the ``bootstrap`` script configures CMake to build with vendored
dependencies.  However, CMake does not vendor OpenSSL.  To bootstrap in a
minimal environment, disable use of OpenSSL::

  $ ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF

Windows
^^^^^^^

There are two ways for building CMake under Windows:

1. Compile with MSVC from VS 2015 or later.
   You need to download and install a binary release of CMake.  You can get
   these releases from the `CMake Download Page`_.  Then proceed with the
   instructions above for `Building CMake with CMake`_.

2. Bootstrap with MinGW under MSYS2.
   Download and install `MSYS2`_.  Then install the required build tools::

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

   and bootstrap as above.

.. _`CMake Download Page`: https://cmake.org/download
.. _`MSYS2`: https://www.msys2.org/

Reporting Bugs
==============

If you have found a bug:

1. If you have a patch, please read the `CONTRIBUTING.rst`_ document.

2. Otherwise, please post to the `CMake Discourse Forum`_ and ask about
   the expected and observed behaviors to determine if it is really
   a bug.

3. Finally, if the issue is not resolved by the above steps, open
   an entry in the `CMake Issue Tracker`_.

.. _`CMake Issue Tracker`: https://gitlab.kitware.com/cmake/cmake/-/issues

Contributing
============

See `CONTRIBUTING.rst`_ for instructions to contribute.

.. _`CONTRIBUTING.rst`: CONTRIBUTING.rst