CMake 4.3 Release Notes¶
Changes made since CMake 4.2 include the following.
New Features¶
Instrumentation¶
cmake-instrumentation(7)was added to enable collection of timing data, target information, and system diagnostic information during the configure, generate, build, test, and install steps of a CMake project:Instrumentation data are indexed and provided to callbacks for custom processing.
Instrumentation data are included in submissions to CDash.
Optionally, Google Trace Event Format files may be generated to visualize instrumentation data.
File-Based API¶
The
cmake-file-api(7)"codemodel" version 2 version field has been updated to 2.10.The
cmake-file-api(7)"codemodel" version 2 "target" object gained a newinterfaceSourcesarray field, and thesourceGroupsarray items gained a newinterfaceSourceIndexesarray field.
Platforms¶
HIPlanguage code may now be compiled for SPIR-V targets, e.g., via chipStar. See theCMAKE_HIP_PLATFORMvariable.
Command-Line¶
cmake --versionnow supports a=json-v1value to print detailed version information in a JSON format.cmake --buildnow supports specifying a build directory and preset together. The build preset will be used with the explicit build directory substituted.The
cmake -Ecommandsmd5sum,sha1sum,sha224sum,sha256sum,sha384sum, andsha512sumnow support reading from standard input by passing-.The
cmake -E bin2ccommand-line tool was added.The
cmake -E tarcommand-line tool:Gained a
--cmake-tar-compression-levelflag to specify the compression level.Gained a
--cmake-tar-compression-methodflag to specify the compression method.Gained a
--cmake-tar-threadsflag to enable multithreaded operations.Now supports specifying compression method and level for
7zipandzipformats.Gained a
--format=rawflag to disable compression.Gained a
--lzmaflag to specifyLZMAcompression.
Commands¶
The
cmake_instrumentation()command was added to make project-level instrumentation queries.The
file(ARCHIVE_CREATE)command:Gained a
THREADSoption to enable multithreaded operations.Now supports
COMPRESSIONmethodDeflateas an alias forGZip.Now supports
COMPRESSIONmethodLZMA.Now supports
COMPRESSIONmethodLZMA2as an alias forXZ.Now supports
COMPRESSIONmethodPPMdfor format7zip.Now supports
COMPRESSIONandCOMPRESSION_LEVELoptions for formats7zipandzip.
The
get_property()andset_property()commands now support aFILE_SETscope for file set properties of a target.The
install(PACKAGE_INFO)andexport(PACKAGE_INFO)commands now support specifyingCXX_MODULES_DIRECTORYfor exporting C++20 modules.The
string(JSON)command gained newGET_RAWandSTRING_ENCODEmodes.The
source_group()command now supportsgenerator expressions.The
cmake_host_system_information()command gained aLOCALE_CHARSETquery for the expectedcmake-language(7)script encoding.
Variables¶
The
CMAKE_<LANG>_LINK_FLAGSandCMAKE_<LANG>_LINK_FLAGS_<CONFIG>variables were added to support per-language link flags for all target types. See policyCMP0210.The
CMAKE_CXX_MODULE_STDvariable and correspondingCXX_MODULE_STDtarget property were added to control the availability ofimport stdfor C++ targets.The read-only
CMAKE_CXX_COMPILER_IMPORT_STDvariable was added to list the C++ standard levels for whichimport stdis available on the current toolchain.The
CMAKE_CXX_STDLIB_MODULES_JSONvariable was added to specify animport stdmodule metadata file instead of relying on automatic detection from the C++ compiler.The
CMAKE_VERIFY_PRIVATE_HEADER_SETSvariable and correspondingVERIFY_PRIVATE_HEADER_SETStarget property were added to enable build rules that verify all headers in private file sets can be used on their own.
Properties¶
A
<LANG>_PVS_STUDIOtarget property and supportingCMAKE_<LANG>_PVS_STUDIOvariable were introduced to tell Makefile Generators and Ninja Generators to runpvs-studio-analyzerwith the compiler forCandCXXlanguages.When
VERIFY_INTERFACE_HEADER_SETSis set to true on an executable target, that target's interface file sets are verified regardless of itsENABLE_EXPORTSproperty. See policyCMP0209.The
PRIVATE_HEADER_SETS_TO_VERIFYtarget property was added to customize which private file sets to verify when the target'sVERIFY_PRIVATE_HEADER_SETSproperty is true.
Modules¶
The
FindCUDAToolkitmodule now creates aCUDA::bin2cimported target for the bin2c utility.The
FindLibXml2module gained aLibXml2_USE_STATIC_LIBShint to select static libraries.The
FindRubymodule now provides imported targets.The
FindSQLite3module now provides imported targets with theSQLite3::prefix.The
UseJavamodule'sadd_jar()command now accepts a newINCLUDE_MODULESoption that adds its arguments to the--module-pathargument to the Java compiler. This allows building JAR files that use JPMS modules in their build.
Generator Expressions¶
String Comparison generator expressions were added.
$<STRING:...>generator expressions were added for query, generation, and transformation operations on strings.The
$<FILE_SET_EXISTS>and$<FILE_SET_PROPERTY>generator expressions were added to query file set existence and properties.The
$<SOURCE_EXISTS>and$<SOURCE_PROPERTY>generator expressions were added to query source file existence and properties.
CTest¶
The
CTestCoverageCollectGCOVmodule:Now supports
TARBALL_COMPRESSIONmethodLZMA.Now supports
TARBALL_COMPRESSIONmethodLZMA2as an alias forXZ.Now supports
FROM_EXTwith file extensions corresponding toLZMAandZSTDcompression.
CPack¶
CPackgained theCPACK_COMPRESSION_LEVELvariable to control the compression level used when creating packages.-
Now supports compression method specification for formats
7zipandzip.Gained a
CPACK_ARCHIVE_COMPRESSION_LEVELoption to control the compression level used when creating archive packages.Gained
CPACK_ARCHIVE_UIDandCPACK_ARCHIVE_GIDoptions to specify the UID and GID of archive entries, respectively. The defaults are UID0and GID0. See policyCMP0206.
The
CPack DEB Generatorgained a newCPACK_DEBIAN_COMPRESSION_LEVELvariable to control the compression level used when creating Debian packages.The
CPack WIX Generatornow supports per-user installers by settingCPACK_WIX_INSTALL_SCOPEtoperUser.
Deprecated and Removed Features¶
The
CMAKE_ENABLE_EXPORTSvariable is deprecated in favor of theCMAKE_EXECUTABLE_ENABLE_EXPORTSandCMAKE_SHARED_LIBRARY_ENABLE_EXPORTSvariables.The
export(EXPORT)command no longer allows certain arguments to be missing or empty. See policyCMP0208.
Other Changes¶
The
cmake -E tarcommand-line tool and thefile(ARCHIVE_EXTRACT)command now reject archive entries whose paths are absolute or contain..path traversal components.The family of
cmake --traceand related commands now print "end" commands for control structures:endblock(),endforeach(),endfunction(),endif(),endmacro(), andendwhile().The
file(CREATE_LINK)command'sCOPY_ON_ERRORoption, when used with a directory, now copies directory content. See policyCMP0205.The
file(GET_RUNTIME_DEPENDENCIES)andinstall(RUNTIME_DEPENDENCY_SET)commands now normalize paths before matching filters. See policyCMP0207.The precompiled Linux
aarch64binaries provided on cmake.org now require GLIBC 2.28 or higher.The precompiled macOS binary provided on
cmake.orgfor macOS 10.13+ now requires macOS 12 or newer for thecmake-gui(1)application. The command-line tools still run on macOS 10.13.The precompiled Windows binaries provided on cmake.org now require Windows 10 or higher.