CMake 4.4 Release Notes¶
Changes made since CMake 4.3 include the following.
New Features¶
Diagnostics¶
CMake diagnostic actions are now tracked in a new state type managed by the
cmake_diagnostic()command. This replaces the old system which sometimes used variables to manage reporting actions and sometimes did not allow management beyond command-line options and presets. The new system also introduces several new diagnostic categories and significantly reduces the cost of adding additional categories in the future. See thecmake-diagnostics(7)manual for a list of available categories.The
CMD_INSTALL_ABSOLUTE_DESTINATIONdiagnostic category was added to diagnoseinstall()commands that specify an absoluteDESTINATION. This diagnostic may be controlled with the-Winstall-absolute-destinationcommand-line option, theinstallAbsoluteDestinationfield in aCMake Presetswarningsobject, or thecmake_diagnostic()command.
Presets¶
cmake-presets(7)files now support schema version 12.cmake(1),ctest(1), andcpack(1)gained--presets-filearguments to support loadingpresetsfrom the specified file instead ofCMakePresets.jsonand/orCMakeUserPresets.json. Seecmake --presets-file,cmake --build --presets-file,cmake --workflow --presets-file,ctest --presets-file, andcpack --presets-filefor details.cmake-presets(7), in schema version 12 and above, now expand the ${fileDir} macro to the directory of the presets file containing the${fileDir}macro, regardless of whether it is inherited by another preset in a different directory.cmake-presets(7)gained support for atestPassthroughArgumentsfield in the test presetexecutionobject for forwarding arguments to test executables via presets.
File-Based API¶
The
cmake-file-api(7)"codemodel" version 2 object has been updated to 2.11.The
cmake-file-api(7)"codemodel" version 2 "target" object's "sources" and "interfaceSources" objects gained newfileSetIndexesfields to support sources belonging to multiple file sets. ThefileSetIndexfields are maintained for backwards compatibility only, and users are advised to port to the new fields.The
cmake-file-api(7)"codemodel" version 2 "target" object's "sources" object gained a newbacktracesfield to represent multiple command invocations which associate a single source for a given target with multiple file sets. Thebacktracefield is maintained for backwards compatibility only, and users are advised to port to the new field.The
cmake-file-api(7)"codemodel" version 2 "installers" object's optionalfileSetTypefield gained a newSOURCESvalue to incorporate the newSOURCESfile set type in codemodel replies.
Instrumentation¶
The
cmake-instrumentation(7)data version has been updated to 1.1.cmake-instrumentation(7)gained acaptureOutputoption which collects thestdoutandstderrof instrumented commands.cmake-instrumentation(7)gained acompileTraceoption which records compiler-generated trace files (e.g., from Clang's-ftime-traceflag).
Generators¶
The Ninja Generators now support generating a build target named
test_prep/<test-name>for each test added byadd_test(), which builds all dependencies for that test. Build dependencies are registered for an executable target invoked by the test, targets referenced in generator expressions in the test command, and explicit dependencies added using the newBUILD_DEPENDSoption. This behavior is enabled by the newCMAKE_TEST_BUILD_DEPENDSvariable. Atest_prep/alltarget is also generated to depend on everytest_prep/<test-name>target. Tests with names that are not valid target names are excluded from this behavior. If multiple tests in different directories share the same name, their dependencies are merged into onetest_prep/<test-name>target.
Languages¶
CUDA language level 23 (corresponding to C++ 23) is now supported with NVCC 13.3 and above.
Compilers¶
C++ 20 named modules are now supported with
clang-cl. Seecmake-cxxmodules(7).The
ibm-flangcompiler is now supported withcompiler idIBMFlang.The Pelles C toolchain is now supported with
compiler idPellesC.The
ASM_POASMlanguage was added to support the Pelles Macro Assembler.The Open Watcom
wlinklinker is now identified withCMAKE_<LANG>_COMPILER_LINKER_IDOpenWatcom.The wild linker is now supported with
CMAKE_<LANG>_COMPILER_LINKER_IDWILD.
Command-Line¶
cmake(1)now supports--build <dir> --preset <pre>regardless of the current working directory.The
cmake -Dcommand-line option now populates a defaultHELPSTRINGfor variables known to CMake.cmake --installnow supports installing multiple components.cmake --installnow accepts-j<N>in addition to-j <N>for specifying the number of parallel jobs.The
cmake -Ecommandscopy_if_different,copy_if_newer,copy_directory,copy_directory_if_different, andcopy_directory_if_newergained support for the-targument.The
cmake -E tarcommand-line tool gained the--cmake-tar-encodingflag to specify the pathname encoding used in archives.
Commands¶
The
block()command can now create aDIAGNOSTICSscope.The
cmake_diagnostic()command was added to manipulate CMake's diagnostic state.The
cmake_parse_arguments()command gained a newPARSE_ARGNsignature that starts parsing after the last named argument of the calling function and works exactly likePARSE_ARGVwith<N>being the number of parameters in the function definition.The
discover_tests()command was added to support registering tests discovered at test time byctest(1). It runs a user-provided discovery command, parses its output, and generates test names, arguments, and properties from regular-expression captures.The
execute_process()command gainedENVIRONMENTandENVIRONMENT_MODIFICATIONoptions to run child processes with a modified environment.The
file(ARCHIVE_CREATE)andfile(ARCHIVE_EXTRACT)commands gained anENCODINGoption to specify the encoding of the archive pathnames. The default is nowUTF-8. See policyCMP0213.The
file(READ_SYMLINK)command gained aRESULToption to capture errors without failing.The
include()command now has aNO_DIAGNOSTIC_SCOPEoption.The
list(FILTER)command gained a newPREDICATEmode that invokes a user-definedfunction()to decide which elements are included or excluded, complementing the existingREGEXmode.The
list(SORT)command gained a newCOMPARATORkeyword that invokes a user-definedfunction()to compare elements, complementing the built-inCOMPAREmethods.The
list(TRANSFORM)command gained a newAPPLYaction that invokes a user-definedfunction()for each element of the list, enabling arbitrary per-element transformations.The
list(TRANSFORM)command gained a newPREDICATEselector that invokes a user-definedfunction()to decide which elements are transformed.The
string(JSON ... PARTIAL_EQUAL)command was added to compare two JSON values using partial equality.
File Sets¶
A
SOURCESfile set type was added to specify a target's source files via file sets.The
CXX_SCAN_FOR_MODULESfile set property was added to control whether a file set's sources are scanned for C++ modules.The
INDEPENDENT_FILESfile set property was added to specify that a file set's sources do not depend on any generated files.The
JOB_POOL_COMPILEfile set property was added to assign a file set's sources to a specific Ninja job pool.The
SCOPE,TYPE,BASE_DIRS,SOURCES, andINTERFACE_SOURCESfile set properties were added to provide the declared details of a file set.The
SKIP_LINTINGfile set property was added to exclude a file set's sources from target-wide code checks.The
SKIP_PRECOMPILE_HEADERSfile set property was added to avoid using precompiled headers for a file set's sources.The
SKIP_UNITY_BUILD_INCLUSIONfile set property was added to exclude a file set's sources from inclusion in unity builds.
Variables¶
The
CMAKE_INSTALL_DEFAULT_COMPONENT_NAMEvariable gained support for a special<PROJECT_NAME>placeholder value. It tells eachinstall()invocation to take a default component name from the currentPROJECT_NAMEvariable value.
Environment Variables¶
The
CMAKE_DISABLE_PRECOMPILE_HEADERSenvironment variable was added to disable precompiled headers by default.
Properties¶
The
VERIFY_INTERFACE_HEADER_SETSandVERIFY_PRIVATE_HEADER_SETStarget properties now always create the per-target verification target and the aggregateall_verify_interface_header_sets,all_verify_private_header_sets, andall_verify_header_setstargets when the property is enabled, even if the target has no matching header sets.The
VERIFY_INTERFACE_HEADER_SETSandVERIFY_PRIVATE_HEADER_SETStarget properties now supportOBJCandOBJCXXlanguages in addition toCandCXX.The
VS_SOLUTION_DEPLOYtarget property is now implemented for targets created byadd_custom_target().
Modules¶
The
CMakePackageConfigHelpersmodule'swrite_basic_package_version_file()command now supportsSamePatchVersion,SameFullVersion, andSemanticVersioncompatibility modes. The olderExactVersionmode is now documented as deprecated in favor of the more explicitSamePatchVersionandSameFullVersionmodes. TheSemanticVersionmode treats0.y.zversions more strictly than1.y.zand later versions.The
ExternalDatamodule gained anExternalData_LINK_MODEvariable to select an ordered list of file materialization modes for hard links, symbolic links, and copies.The
ExternalDatamodule gained anExternalData_STATE_ROOTvariable to store hash records outsideExternalData_BINARY_ROOT.The
ExternalProjectandFetchContentmodules gainedCMAKE_EP_GIT_CLONE_RETRY_COUNTandCMAKE_EP_GIT_CLONE_RETRY_DELAYvariables to controlgit cloneretries.The
FindCUDAToolkitmodule now creates aCUDA::sanitizertarget for the compute-sanitizer library.The
FindCUDAToolkitmodule now provides an imported target forcufiltin CUDA 11.4 and above.FindPythonandFindPython3modules gained the support of the Stable ABI for Free Threaded Python (SABIT) as specified by PEP 803.
Generator Expressions¶
The
TARGET_OBJECTSgenerator expression now has an optionalSOURCE_FILES:...argument, which can take one or more source files as arguments, and will filter its output to only include objects built from those source files.
Swift¶
The Ninja Generators gained the
Swift_SEPARATE_MODULE_EMISSIONtarget property, initialized by theCMAKE_Swift_SEPARATE_MODULE_EMISSIONvariable, to control whether importable Swift targets emit.swiftmodulefrom a dedicated build edge. PolicyCMP0215enables this by default.The default
Swift_MODULE_NAMEnow replaces hyphens with underscores, since hyphens are not valid in Swift module identifiers.Swift targets now have a package name by default. See policy
CMP0216.The
Swift_PACKAGE_NAMEtarget property was added to specify a Swift package name.Swift targets on Windows now support the
$<TARGET_PDB_FILE:...>family of generator expressions.
CTest¶
ctest(1)gained support for forwarding extra arguments to test executables using a--separator.ctest(1)gained a CoverageTool option in Dashboard Client mode to configure tests for coverage collection byllvm-cov.The
ctest_configure(),ctest_build(),ctest_test(), andctest_memcheck()commands gainedPRESETandPRESETS_FILEarguments to support usingpresetsfor their Dashboard Client steps.The
CTEST_CONFIGURE_PRESET,CTEST_BUILD_PRESET,CTEST_TEST_PRESET,CTEST_PRESET, andCTEST_PRESETS_FILEvariables may be used to specify preset arguments to the above commands in a Dashboard Client script or on the ctest command line via the-Doption.ctest(1)gained support for aCTEST_SUBMIT_PARTSvariable that restricts which parts are uploaded when operating in Dashboard Client mode.The
ctest_update()command gainedVERSION_ONLYandVERSION_OVERRIDEoptions to select or report a source revision without requiring the correspondingCTEST_UPDATE_VERSION_ONLYorCTEST_UPDATE_VERSION_OVERRIDEdashboard script variables.
CPack¶
The
CPack Archive Generatorgained theCPACK_ARCHIVE_ENCODINGvariable to specify the pathname encoding used in package archives.The
CPack NSIS Generatorgained a new variableCPACK_NSIS_IGNORE_COMPONENTS_PAGEto ignore the component selection page in the installer.The
CPACK_RPM_SPEC_MORE_DEFINEvariable now supports a list of definitions.
Deprecated and Removed Features¶
The
-W[no-][error=]devcommand-line options are deprecated. The new spelling is-W[no-][error=]author.The
--warn-uninitializedcommand-line option is deprecated. The new spelling is-Wuninitialized.The
--no-warn-unused-clicommand-line option is deprecated. The new spelling is-Wno-unused-cli.The
CMAKE_WARN_DEPRECATEDandCMAKE_ERROR_DEPRECATEDvariables are deprecated. The newcmake_diagnostic()command should be used instead.The
MACROSdirectory property does not exist anymore. See policyCMP0217.
Other Changes¶
A file may belong to at most one non-
HEADERSfile set in a target. See policyCMP0211.macro()invocations now preserve backslashes in arguments. See policyCMP0219.variable_watch()callback command arguments preserve backslashes. See policyCMP0219.ctest(1)now exits with non-zero if invoked with no arguments and no test input file exists.Test drivers generated by the
create_test_sourcelist()command now support the-Noption to list all tests, one per line. This is useful in combination with the newdiscover_tests()command.Names of executables given to the
DEPENDSargument ofadd_custom_command()no longer have.exesuffixes stripped to establish target-level dependencies. See policyCMP0212.Targets which provide C++ modules may now be consumed by targets with different
compile featuresandoptionsthan the provider.