CMake v4.5.0-rc3

v4.5.0-rc3Pre-release
Added 17
  • The CMD_NON_TARGET_DIRECTIVE diagnostic category diagnoses commands that affect directory scope when comparable target-specific commands exist, controllable via -Wnon-target-directive, the nonTargetDirective warnings preset field, or cmake_diagnostic()
  • The CMD_STRICT diagnostic category controls diagnostics for allowed but discouraged usage as a group, controllable via -Wstrict, the strict warnings preset field, or cmake_diagnostic()
  • cmake-presets(7) files now support schema version 13
  • The ${configurePresetName} macro expands to the name of the associated configure preset for configure, build, test, and package presets
  • The cmake-file-api(7) codemodel version 2 target object gained an interfaceIncludes array field
  • cmake-instrumentation(7) records an overall cmakeBuild snippet with an interruptSignal field when a cmake --build invocation is interrupted by the user
Changed 5
  • The cmake-file-api(7) codemodel version 2 version field is updated to 2.12
  • The cmake-instrumentation(7) data version is updated to 1.2
  • On interrupt, CTest stops scheduling further tests and preserves its checkpoint file so a later ctest -F can resume the interrupted test set
  • Ninja generators now provide test_prep/<test-name> and test_prep/all targets by default, disableable with CMAKE_SKIP_TEST_PREP_TARGETS, instead of only when CMAKE_TEST_BUILD_DEPENDS was enabled
  • Build, test, and package presets whose configure preset is unavailable are now considered unavailable

From CMake

CMake 4.5 Release Notes

Changes made since CMake 4.4 include the following.

New Features
Diagnostics
  • The CMD_NON_TARGET_DIRECTIVE diagnostic category was added to diagnose commands that affect the directory scope when comparable target-specific commands exist. The use of such directives is discouraged. This diagnostic may be controlled with the -Wnon-target-directive command-line option, the nonTargetDirective field in a CMake Presets warnings object, or the cmake_diagnostic() command.
  • The CMD_STRICT diagnostic category was added to control diagnostics regarding allowed but discouraged usage as a group. This diagnostic may be controlled with the -Wstrict command-line option, the strict field in a CMake Presets warnings object, or the cmake_diagnostic() command.
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
  • The Ninja Generators, Makefile Generators, and FASTBuild generator now provide install_prep/all and install_prep/ convenience build targets by default. The CMAKE_SKIP_INSTALL_PREP_TARGETS variable may be enabled to skip generating them. These targets build all known build dependencies for an installation that does not select a component, or for the named install component, respectively. This includes targets that produce installed C++ module BMIs, module export metadata, or generated files. See Install Preparation Targets.
  • The FASTBuild generator and the Makefile Generators now provide test_prep/ and test_prep/all convenience build targets by default. The CMAKE_SKIP_TEST_PREP_TARGETS variable may be enabled to skip generating them. These targets build the dependencies of tests added by add_test(), including those listed with the BUILD_DEPENDS keyword. See Test Preparation Targets.
  • The Ninja Generators now provide test_prep/ and test_prep/all convenience build targets build targets by default. The CMAKE_SKIP_TEST_PREP_TARGETS variable may be enabled to skip generating them. These targets were previously generated only if CMAKE_TEST_BUILD_DEPENDS was enabled. See Test Preparation Targets.
  • Makefile Generators and Ninja Generators gained support for adding a linker launcher with CUDA and HIP. See the CMAKE__LINKER_LAUNCHER variable and _LINKER_LAUNCHER target property for details.
Languages
  • import std is now available for all C++ 20 and later code with CXX_SCAN_FOR_MODULES enabled.
Compilers
  • The open-source DPC++ compiler, version 7.0 and newer, is now supported with compiler id DPClang for languages C and CXX.
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
  • The add_custom_rule() command was added to allow the definition of pattern rules.
  • The add_dependencies() command now accepts Alias Targets. Dependencies are added to the target the alias references.
  • The discover_tests() command gained a BUILD_DEPENDS argument to support the --out-of-date behavior of ctest(1).
  • The cmake_language(PRINT_PROPERTIES) command was added to print CMake entities' properties in human-readable form for debugging.
  • The cmake_language(PRINT_TARGETS) command was added to print the targets that currently exist in human-readable form for debugging.
  • The cmake_language(PRINT_VARIABLES) command was added to print variables and their values in human-readable form for debugging.
  • The file(ARCHIVE_CREATE) command gained a PATTERNS_EXCLUDE option to omit files and directories matching the given patterns from the created archive.
  • The file(ARCHIVE_EXTRACT) command gained a PATTERNS_EXCLUDE option to omit archive entries matching the given patterns from being extracted or listed.
  • The file(GET_RUNTIME_DEPENDENCIES) command is now implemented on FreeBSD.
  • The find_package() command now supports importing Common Package Specification executable components.
  • The function() command now sets the ARGNC variable, which holds the number of arguments past the last expected argument.
  • The if() command gained a PATH_IS_PREFIX operator to test whether one path is a prefix of another without accessing the filesystem. See policy CMP0222.
  • The if() command gained a RULE operator to check if a rule exists.
  • The install() and export() commands now accept Alias Targets. The commands operate on the underlying aliased target.
  • The install(SBOM) and export(SBOM) commands were added to generate Software Bill of Materials (SBOM) files.
  • The install(TARGETS) command no longer requires a LIBRARY DESTINATION for Module Libraries. When no destination is given, a module library is installed to the default RUNTIME destination on DLL platforms and to the default LIBRARY destination on other platforms.
  • The install(TARGETS) command gained a RUNTIME_DEPENDENCY_TARGETS option to install runtime artifacts of non-imported shared libraries from the same build that the named targets link to. Unlike RUNTIME_DEPENDENCIES, this uses CMake target graph information rather than file(GET_RUNTIME_DEPENDENCIES). The option cannot be used with EXPORT and may only install runtime artifacts.
  • The install() command's FILES, PROGRAMS, DIRECTORY, SCRIPT, and CODE signatures gained a BUILD_DEPENDS option to specify targets or files needed to prepare files or run installation code. See Install Preparation Targets.
  • The math() command gained new INCREMENT and DECREMENT modes.
  • The project() and enable_language() commands, when called in subdirectories, now propagate support for enabled languages to all ancestor scopes up to the top-level directory, including through enclosing block() and function() scopes. See policy CMP0220.
  • The set_property() and get_property() commands now support RULE properties.
  • The set_property() and set_target_properties() commands now accept Alias Targets. Properties are set on the target which the alias references.
  • The string(JSON) command gained an ARRAY_SPLIT mode that splits a JSON array into a list of its elements with a single parse, enabling linear-time array iteration instead of re-parsing the whole JSON string for each element.
  • The target_compile_definitions(), target_compile_features(), target_compile_options(), target_include_directories(), target_link_directories(), target_link_libraries(), target_link_options(), target_precompile_headers(), and target_sources() commands now accept Alias Targets. The command operates on the target the alias references.
File Sets
  • Common Package Specification import by find_package(), and export by install(PACKAGE_INFO) and export(PACKAGE_INFO), now support header file sets.
  • The source_group() command gained support for file sets.
  • The FILE_SET_TYPES, FILE_SETS_, and INTERFACE_FILE_SETS_ target properties were added to get information about file sets attached to the target.
  • The LANGUAGE file set property was added to select the compile language for members of a SOURCES file set without modifying their LANGUAGE source file property.
  • The SOURCE_GROUP file set property and SOURCE_GROUP source file property were added to provide a fine grain control over the grouping of sources.
Variables
  • The CMAKE_CXX_STDLIB_MODULES_JSON variable was added to set the path to the import std metadata file for the standard library rather than using the compiler to discover its location.
  • The CMAKE_INSTALL_SBOM_FORMATS variable was added to enable Software Bill of Materials (SBOM) generation.
  • The CMAKE_TEST_BUILD_DEPENDS variable is no longer honored. Test preparation targets are now enabled by default. The CMAKE_SKIP_TEST_PREP_TARGETS variable may be enabled to skip generating them.
Environment Variables
  • The CMAKE_SYSTEM_ENVIRONMENT_ID environment variable was added to hint to cmake(1) when --fresh may be necessary, along with CMAKE_SYSTEM_ENVIRONMENT_ACTION to control what happens when CMAKE_SYSTEM_ENVIRONMENT_ID changes.
Properties
  • The CMAKE_COMPILE_WRAPPER_ and CMAKE_LINK_WRAPPER_ global properties were added alongside the COMPILE_WRAPPERS, LINK_WRAPPERS, INTERFACE_COMPILE_WRAPPERS, and INTERFACE_LINK_WRAPPERS target properties. Together, for the Makefile Generators and Ninja Generators, they support wrapping compile and link commands for a given target or its consumers with arbitrary command lines.
  • The CMAKE_TEST_BUILD_DEPENDS directory property was added to support directory-scoped build time dependencies for tests.
  • The Fortran_BUILDING_INTRINSIC_MODULES target property is now honored by the Ninja Generators. Previously it was only honored by the Makefile Generators.
  • The Swift_MODULE_NAME target property is now honored by the Xcode generator. See policy CMP0226.
  • The TEST_INCLUDE_FILES and TEST_INCLUDE_FILE directory properties now support generator expressions in the include path. On multi-config generators a $-parameterized path can select a different script per configuration.
  • The XCODE_EMBED_ target property now supports generator expressions. Because Xcode shares one copy-files build phase across all configurations, an expression whose result depends on the configuration is rejected with an error.
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. …
View original

Upgraded? How did it go?

Discussion