[CMake](https://cmake.org), the cross-platform, open-source build system.
Find a file
Brad King 116272e296 Merge topic 'use-triggers-instead-of-ldconfig-calls'
302a645d73 CPack/DEB: use `triggers` instead of legacy postXXX scripts for `ldconfig`
f461382d42 CPack/DEB: rename variable w/ result of `dpkg` find to match other vars
8a8bceda98 CPack/DEB: rename internal variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11779
2026-03-06 13:47:52 -05:00
.github Update links to gitlab.kitware.com repos to add -/ 2020-05-26 11:38:01 -04:00
.gitlab Merge topic 'ci-windows-qt-6.9.3' 2026-03-05 09:49:30 -05:00
Auxiliary CPS: Remove experimental gate (mostly) 2026-02-11 16:10:29 -05:00
Help Merge topic 'instrumentation-gui-generate' 2026-03-05 10:04:51 -05:00
Licenses cmake-gui: Reference LGPLv3 when redistributing Qt 2016-06-17 15:02:54 -04:00
Modules Merge topic 'use-triggers-instead-of-ldconfig-calls' 2026-03-06 13:47:52 -05:00
Packaging cmake-gui: Refactor installation into CMake.app/Contents on macOS 2025-10-31 09:33:52 -04:00
Source Merge topic 'use-triggers-instead-of-ldconfig-calls' 2026-03-06 13:47:52 -05:00
Templates Avoid signed char-to-int conversions in tolower/toupper calls 2026-02-06 10:39:52 -05:00
Tests CPack/DEB: use triggers instead of legacy postXXX scripts for ldconfig 2026-03-05 23:14:10 +04:00
Utilities libarchive: Backport "7zip: Fix out-of-bounds access on ELF 64-bit header" 2026-03-02 15:04:35 -05:00
.clang-format clang-format: Fix order of QCmake* includes 2026-03-05 13:50:48 -05:00
.clang-tidy clang-tidy: ignore warnings new in version 21 2025-10-30 17:43:17 -04:00
.codespellrc codespell: Prune ignore list 2025-11-04 13:13: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 gitattributes: Do not export ast-grep infrastructure in source archives 2025-12-10 14:24:48 -05:00
.gitignore gitignore: Tell tools honoring .gitignore to ignore .git too 2025-01-22 08:51:44 -05:00
.gitlab-ci.yml ci: Reduce redundant coverage of older Intel compilers on Linux 2026-02-25 09:46:00 -05:00
.hooks-config LICENSE: Replace references to Copyright.txt with LICENSE.rst 2025-03-03 10:43:35 -05:00
.pre-commit-config.yaml pre-commit: version bump typos hook + fix found typo 2026-03-02 09:54:13 -05:00
.typos.toml ci: configure 'typos' to tolerate a NSIS command 2026-02-08 16:15:58 -05:00
bootstrap FileSet management: Introduce dedicated classes for generation 2026-02-19 17:35:56 +01: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 Configure CMake itself with policies through CMake 4.2 2026-02-17 16:43:00 -05: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 Simplify bootstrap script source dir detection 2009-09-25 10:48:24 -04:00
CONTRIBUTING.rst LICENSE: Rename Copyright.txt to LICENSE.rst 2025-03-03 09:55:56 -05:00
CONTRIBUTORS.rst Help: Fix lexing of multi-line strings 2026-02-13 13:36:59 -05:00
CTestConfig.cmake LICENSE: Replace references to Copyright.txt with LICENSE.rst 2025-03-03 10:43:35 -05:00
CTestCustom.cmake.in CTestCustom: ignore coverage results from coverage tests 2025-09-29 11:11:07 -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 LICENSE: Rename Copyright.txt to LICENSE.rst 2025-03-03 09:55:56 -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.

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 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

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