CMake version recommendations and install
Downloading the latest release of CMake is usually easy. Admin / sudo is not required.
- Linux:
snap install cmake - macOS: brew install cmake
- Windows:
winget install Kitware.CMake - PyPI CMake package:
python -m pip install cmake
For platforms where CMake binaries aren’t easily available, build CMake using scripts/build_cmake.cmake.
To see the merge requests for a certain release, use a URL like: https://gitlab.kitware.com/cmake/cmake/-/merge_requests?milestone_title=3.32.0&scope=all&state=all
CMake 4.3 additions include:
- Common Package Specification (CPS) officially supported. This provides a solution for the long-standing program of build system-agnostic JSON package configuration files, which can be generated by CMake’s
install(EXPORT)and consumable by other build systems. cmake --version=json-v1tells details of the libraries vendored into CMake, which is useful for debugging and reporting issues with CMake’s bundled dependencies. This is complementary to cmake -E capabilities which reports specific capabilities of the CMake.- CMake command line and archive create commands can specify compression level and algorithm in more detail
- numerous generator string expressions were added
CMake 4.2 additions include:
- Visual Studio 18 2026 generator.
- FASTBuild generator has impressive benchmarks. FASTBuild supports more modern platforms including Windows, versus ccache or distcc.
- ExternalProject added options to modify environment variables at each step by CONFIGURE_ENVIRONMENT_MODIFICATION, BUILD_ENVIRONMENT_MODIFICATION, INSTALL_ENVIRONMENT_MODIFICATION, TEST_ENVIRONMENT_MODIFICATION
- Target property SPDX_LICENSE
CMake 4.1 additions include:
- project() added COMPAT_VERSION that propagates to subdirectories and can be queried for the top-level COMPAT_VERSION.
CMake 4.0 additions include:
- CMAKE_LINK_WARNING_AS_ERROR boolean option sets most compilers to error if a compile warning occurs, which is generally a good setting for CI systems.
- target_link_libraries()
can use a
LINKER:prefix to abstract options. - CMAKE_POLICY_VERSION_MINIMUM allows a user or project to call other projects that haven’t been updated to a newer CMake minimum version.
- SARIF output allows IDEs to better parse build status.
- CTest –interactive-debug-mode is particularly useful on Windows to enable debug dumps and error popup windows.
CMake 3.31 additions include:
- CMake warns if
cmake_minimum_required()is < 3.10. - TLS ≥ 1.2 is required by default for internet operations e.g.
file(DOWNLOAD), ExternalProject, FetchContent, and similar. - file(ARCHIVE_CREATE)
gained a long-needed
WORKING_DIRECTORYparameter that is essentially necessary to avoid machine-specific paths being embedded in the archive. - CMAKE_LINK_LIBRARIES_STRATEGY allows specifying a strategy for ordering target direct link dependencies.
CMake 3.30 additions include:
- C++26 support.
- CMAKE_TLS_VERIFY environment variable was added to set TLS verification (true, false).
- defaults CMAKE_TLS_VERIFY to on, where previously it was off.
CMake 3.29 additions include:
- cmake_language(EXIT code) to exit CMake script mode with a specific return code. This is useful when using CMake as a platform-agnostic scripting language instead of shell script.
- Environment variable
CMAKE_INSTALL_PREFIX
is used to set the default install prefix across projects–it can be overridden as typical by
cmake -DCMAKE_INSTALL_PREFIX=option. - Target property TEST_LAUNCHER allows specifying a test launcher. For MPI program this allows deduplicating or making more programmatic test runner scripts.
- Linker information variables including
CMAKE_
_COMPILER_LINKER_ID have been added to allow programmatic logic like settingtarget_link_options()based on the particular linker. ctest --parallelwithout a number or0will use unbounded test run parallelism.
CMake 3.28 additions include:
-
changes PATH behavior for Windows find_{library,path,file}() to no longer search PATH. This may break some projects that rely on PATH for finding libraries. MSYS2-distributed CMake is patched to include PATH like earlier CMake, which can be confusing for CI etc. not using MSYS CMake with that patch. Windows CI/user may need to specify
CMAKE_PREFIX_PATHlikecmake -DCMAKE_PREFIX_PATH=$Env:SYSTEMDRIVE/msys64/ucrt64/lib -B build -
Support for C++20 modules is considerably improved and most users will want at least CMake 3.28 to make C++ modules usable.
-
Generator expressions
$<IF> $<AND> $<OR>now short circuit. -
Test properties now have a
DIRECTORYparameter, useful for setting test parameters from the project’s top level CMakeLists.txt. -
CMake 3.28.4 fixed a long-standing bug in Ninja Fortran targets that use
includestatements.
CMake 3.27 additions include:
- emits warning for cmake_minimum_required(VERSION) < 3.5.
- CTest test properties TIMEOUT_SIGNAL_NAME and TIMEOUT_SIGNAL_GRACE_PERIOD specify a POSIX signal to send to a timed out test process.
- Interactive CMake debugger added by
cmake --debuggeris used with an IDE such as Visual Studio. - CMake script command cmake_file_api() allows querying CMake File API from within CMake.
ℹ️ Note
Fortran + Ninja was broken for OBJECT libraries in CMake 3.27.0..3.27.8 and fixed in 3.27.9.