[CMake](https://cmake.org), the cross-platform, open-source build system.
  • C 39.2%
  • C++ 30%
  • CMake 27.9%
  • Roff 0.6%
  • Python 0.5%
  • Other 1.2%
Find a file
2026-12-03 00:12:43 -05:00
.devcontainer devcontainer: Add ast-grep 2026-09-29 08:07:50 -04:00
.github Update links to gitlab.kitware.com repos to add -/ 2020-05-26 11:38:01 -04:00
.gitlab cmake-gui: Require Qt 6.2 or newer 2026-12-01 16:52:56 -05:00
Auxiliary ctest: Add CTEST_CONFIGURE_OPTIONS to pass options to the CMake configure step 2026-11-12 15:19:44 -05:00
Help Merge topic 'makefile-shell' 2026-12-02 09:05:58 -05:00
Licenses cmake-gui: Reference LGPLv3 when redistributing Qt 2016-06-17 15:02:54 -04:00
Modules Merge topic 'unknown-compiler-version' 2026-12-02 08:49:26 -05: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-12-03 00:12:43 -05:00
Templates Merge topic 'msvc-c++23' 2026-11-12 09:51:00 -05:00
Tests Merge topic 'feature/cmake-gui-remove-qt5' 2026-12-02 09:08:34 -05:00
Utilities cm/constexpr: Drop pre-C++17 compatibility 2026-12-01 16:34:33 -05:00
.clang-format clang-format: Fix order of QCmake* includes 2026-03-05 13:50:48 -05:00
.clang-tidy clang-tidy: Disable checks that require C++20 2026-11-26 10:03:41 -05:00
.codespellrc cmSubcommandTable: Implement closest string for invalid subcommand 2026-11-01 13:58:09 -05:00
.editorconfig Add .editorconfig file 2020-12-21 21:13:58 +01:00
.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 gitignore: Tell tools honoring .gitignore to ignore .git too 2025-01-22 08:51:44 -05:00
.gitlab-ci.yml ci: Add UndefinedBehaviorSanitizer build and test jobs 2026-11-27 02:04:01 -08:00
.hooks-config LICENSE: Replace references to Copyright.txt with LICENSE.rst 2025-03-03 10:43:35 -05:00
.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 CPack/WIX: Add perUserOrMachine install scope 2026-11-16 15:35:17 -05:00
bootstrap cmake-gui: Require Qt 6.2 or newer 2026-12-01 16:52:56 -05:00
cmake_uninstall.cmake.in cmake_uninstall.cmake.in: Replace exec_program() with execute_process() 2023-07-24 17:59:24 -04:00
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 Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
CMakeLists.txt KWSys 2026-12-01 (1505762d) 2026-12-01 06:39:31 -05:00
CompileFlags.cmake EMBTClang: Add support for the Embarcadero bcc64x compiler 2026-10-28 14:58:31 -04:00
configure Simplify bootstrap script source dir detection 2009-09-25 10:48:24 -04:00
CONTRIBUTING.rst devcontainer: Add a Dev Container definition for CMake development 2026-09-08 16:23:33 +00:00
CONTRIBUTORS.rst CONTRIBUTORS: Add Khronos Group 2026-10-13 11:45:30 -04:00
CTestConfig.cmake LICENSE: Replace references to Copyright.txt with LICENSE.rst 2025-03-03 10:43:35 -05:00
CTestCustom.cmake.in CTestCustom: Suppress clang-analyzer warning in libuv 2026-10-26 16:15:30 -04:00
DartConfig.cmake LICENSE: Replace references to Copyright.txt with LICENSE.rst 2025-03-03 10:43:35 -05:00
LICENSE.rst CMake Nightly Date Stamp 2026-01-01 00:06:14 -05:00
README.rst Require C++17 to compile CMake itself 2026-11-29 11:36:41 -05: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++17) 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