[CMake](https://cmake.org), the cross-platform, open-source build system.
Find a file
Brad King 3277ef73c8 Merge topic 'FindLibXml2-static'
5f2f36f1ea FindLibXml2: Add a LibXml2_USE_STATIC_LIBS hint

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11476
2025-12-05 09:07:30 -05:00
.github Update links to gitlab.kitware.com repos to add -/ 2020-05-26 11:38:01 -04:00
.gitlab Merge topic 'emscripten-try_run' 2025-11-26 10:00:10 -05:00
Auxiliary cmake-gui: Refactor installation into CMake.app/Contents on macOS 2025-10-31 09:33:52 -04:00
Help Merge topic 'FindLibXml2-static' 2025-12-05 09:07:30 -05:00
Licenses cmake-gui: Reference LGPLv3 when redistributing Qt 2016-06-17 15:02:54 -04:00
Modules FindLibXml2: Add a LibXml2_USE_STATIC_LIBS hint 2025-12-04 15:51:35 -05:00
Packaging cmake-gui: Refactor installation into CMake.app/Contents on macOS 2025-10-31 09:33:52 -04:00
Source Merge topic 'fix-27420' 2025-12-05 09:04:58 -05:00
Templates VS: Add CUDA flag table entry for nvcc --keep flag 2025-11-12 15:04:09 -05:00
Tests Merge topic 'fix-27420' 2025-12-05 09:04:58 -05:00
Utilities Utilities/ast-grep: add rules for cmHasLiteral{Suf,Pre}fix with char needles 2025-11-20 12:14:14 -05:00
.clang-format clang-format: Enforce "east const" qualifier placement 2025-01-23 11:48:37 -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 git-fetch-file: track update-common.sh 2025-11-07 15:37:02 -05:00
.gitattributes clang-format: Apply formatting to HIP sources with .hip extension 2025-04-09 13:31:38 -04:00
.gitignore gitignore: Tell tools honoring .gitignore to ignore .git too 2025-01-22 08:51:44 -05:00
.gitlab-ci.yml Merge topic 'ci-vs2026' 2025-11-23 11:42:27 -05:00
.hooks-config LICENSE: Replace references to Copyright.txt with LICENSE.rst 2025-03-03 09:56:07 -05:00
.pre-commit-config.yaml ci(pre-commit): bump pre-commit hooks + fixes of found typos 2025-11-26 02:32:04 +04:00
.typos.toml pre-commit: version bump typos hook plus fix found typos 2025-10-30 17:43:16 -04:00
bootstrap introduce cm::CMakeString class as helper for string() command 2025-11-14 16:44:29 +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 Utilities: Announce both system-installed and bundled dependencies 2025-12-01 15:03:04 -05:00
CMakeLogo.gif ENH: fancier logo 2007-11-26 13:21:57 -05:00
CMP0207-NEW-all-result.txt file(GET_RUNTIME_DEPENDENCIES): Normalize paths before matching 2025-11-14 17:23:26 +03:00
CMP0207-NEW-all-stderr.txt file(GET_RUNTIME_DEPENDENCIES): Normalize paths before matching 2025-11-14 17:23:26 +03:00
CompileFlags.cmake Linux: Compile with 64-bit time_t even on 32-bit architectures 2025-06-26 09:23:33 -04: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 CONTRIBUTORS: Update per-contributor hyperlinks 2025-03-04 08:57:03 -05:00
CTestConfig.cmake LICENSE: Replace references to Copyright.txt with LICENSE.rst 2025-03-03 09:56:07 -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 09:56:07 -05:00
LICENSE.rst CONTRIBUTORS: Factor contributors list out of license file 2025-03-03 09:56:17 -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