CMake 4.5 Release Notes

Changes made since CMake 4.4 include the following.

New Features

Diagnostics

Presets

  • cmake-presets(7) files now support schema version 13.

  • cmake-presets(7) gained the ${configurePresetName} macro to expand to the name of the configure preset associated with the preset being evaluated. It is available for configure, build, test, and package presets, but not for workflow presets.

File-Based API

  • The cmake-file-api(7) "codemodel" version 2 version field has been updated to 2.12.

  • The cmake-file-api(7) "codemodel" version 2 "target" object gained a new interfaceIncludes array field.

Instrumentation

  • The cmake-instrumentation(7) data version has been updated to 1.2.

  • cmake-instrumentation(7) now records an overall cmakeBuild snippet even when a cmake --build invocation is interrupted by the user (for example with Ctrl+C). The snippet includes a new interruptSignal field, recording the signal that interrupted the build, so that consumers can distinguish an interrupted build from one that ran to completion.

  • cmake-instrumentation(7) now records an overall cmakeInstall snippet, marked with the same interruptSignal field, when a cmake --install invocation is interrupted by the user.

  • cmake-instrumentation(7) now records an overall ctest snippet, marked with the same interruptSignal field, when a ctest(1) invocation is interrupted by the user. On interrupt CTest stops scheduling further tests and preserves its checkpoint file so that a later ctest -F can resume the interrupted test set.

Generators

Languages

Compilers

Command-Line

  • The cmake -E capabilities output now includes an instrumentation object reporting the supported instrumentation API version and the latest supported data version.

  • The cmake --list-presets option gained *-defined values that list all non-hidden presets of the corresponding type and explain why unavailable presets cannot be used. The defined value is an alias for configure-defined, while all-defined selects every type. Build, test, and package presets whose configure preset is unavailable are now considered unavailable too.

  • The cmake --build --list-presets=defined, ctest --list-presets=defined, and cpack --list-presets=defined options were added to list all defined build, test, and package presets, respectively.

  • The cmake --workflow --list-presets=defined option was added to provide the same availability information for all defined workflow presets and their steps.

Commands

File Sets

Variables

Environment Variables

Properties

Modules

  • The ExternalProject module's ExternalProject_Add() command now sets CMAKE_INSTALL_PREFIX to the external project's INSTALL_DIR in its default configure command, so a CMake external project installs into the prefix the module reserves for it rather than the built-in default (e.g. /usr/local). A caller-supplied prefix still takes precedence. See policy CMP0225.

  • The FindCUDAToolkit module now creates CUDAToolkit:: namespace targets and changes the existing CUDA:: namespace targets to be alias targets.

  • The FindDoxygen module doxygen_add_docs() command gained a USES_TERMINAL option to give the Doxygen command direct access to the terminal during the build.

  • The FindPython, FindPython2, and FindPython3 modules gained the possibility to override the CMAKE_CROSSCOMPILING_EMULATOR variable by respectively, the variables Python_CROSSCOMPILING_EMULATOR, Python2_CROSSCOMPILING_EMULATOR, and Python3_CROSSCOMPILING_EMULATOR.

  • The FindPython3 and FindPython modules gained, respectively, the variable Python3_SOSABI_PLATFORM and Python_SOSABI_PLATFORM which gives, on some platforms, for the Stable Application Binary Interface, the extension including the platform triplet.

Generator Expressions

  • The $<ARGS> generator expression was added to convert a semicolon-separated list into a comma-separated list.

  • The $<DIRECTORY_PROPERTY> generator expression was added to query directory properties.

  • The $<GLOBAL_PROPERTY> generator expression was added to query global properties.

  • The LIST generator expression's FILTER and TRANSFORM operations gained a PREDICATE keyword that selects items by evaluating an arbitrary generator expression once per item, with $<_0> referring to the current item. FILTER also gained an explicit REGEX keyword.

  • The LIST generator expression's SORT operation gained a COMPARATOR option that orders items using an arbitrary generator expression evaluated once per comparison, with $<_0> and $<_1> referring to the two items being compared.

  • The LIST generator expression's TRANSFORM operation gained an APPLY action that evaluates an arbitrary generator expression for each element, with $<_0> referring to the current element.

  • The $<LINK_LIBRARY:NEEDED_LIBRARY,...> generator expression feature is now supported on Linux with GNU-compatible linkers (GNU ld, gold, LLD, MOLD).

  • The RULE_PROPERTY generator expression was added to query properties of rules created by the add_custom_rule() command.

Autogen

  • AUTOMOC now processes C++ module interface and partition units that are members of a FILE_SET of type CXX_MODULES. moc is run on such units and its generated output is compiled as a module implementation unit of the same module. This requires Qt 6.13 or newer, whose moc supports C++ module units.

  • AUTOMOC now has its generated mocs_compilation.cpp scanned for C++ module dependencies under the same conditions as the target's own sources. A header that imports a module may now be processed by moc.

CTest

CPack

  • The CPack APK Generator was added to package Android applications as APK files. It drives the Android SDK build tools directly and does not require Gradle. Maven dependencies, such as the AndroidX libraries, can be downloaded with CPACK_APK_MAVEN_DEPENDENCIES.

Deprecated and Removed Features

Other Changes

  • The cmake --build command now groups the output of each recipe in a parallel build so that concurrent jobs do not interleave, when CMake is the one passing the parallel flag to the build tool (via --parallel or CMAKE_BUILD_PARALLEL_LEVEL) and that tool is GNU Make 4.0 or newer. Request parallelism natively, e.g. cmake --build . -- -j, to opt out and stream output as it is produced.

  • The cmake --install command now reports a non-zero exit code when an install script fails. Previously, a parallel install (enabled by the INSTALL_PARALLEL global property) always reported success, and a serial install could lose the failure of an earlier component that exited via cmake_language(EXIT) when a later component succeeded.

  • The cmake_host_system_information() command's DISTRIB_* queries now read the host os-release by default. See policy CMP0221. A new FROM_SYSROOT <bool> option explicitly enables or disables reading the target os-release from CMAKE_SYSROOT.

  • The cmake_path(IS_PREFIX) command and the $<PATH:IS_PREFIX> generator expression no longer treat an empty path as a prefix of every path. The if() command's PATH_IS_PREFIX operator follows the same rule. See policy CMP0223.

  • When CTest build launchers are enabled (see the CTestUseLaunchers module), a build rule that is terminated by a signal is now reported as a build failure. Previously such a rule was reported as success, so a crashed compiler, linker, or custom command could be recorded as a passing build on the dashboard.

  • The ALIASED_TARGET target property is now read-only.

  • The Qt Help (.qch) rendition of the documentation now carries its own color scheme. Previously it was rendered with layout rules only, because the qthelp builder does not generate the color scheme that the HTML documentation uses. A dark variant is shipped alongside it, which help viewers such as Qt Creator use when their own theme is dark.

  • The precompiled macOS binary provided on cmake.org now requires macOS 11 or newer for command-line tools. The cmake-gui(1) application still requires macOS 12.