# CMake 4.3 Release Notes

Changes made since CMake 4.2 include the following.

## New Features

### Common Package Specification

- Support for importing and exporting packages described using the Common Package Specification (CPS) was added. This improves build system interoperability by allowing expressive, feature-rich package descriptions to be exchanged in a format other than CMake Language.

  - The `find_package()` now searches for and can import CPS packages.

  - The `install()` and `export()` commands gained a new `PACKAGE_INFO` sub-command to generate CPS package descriptions.

  - The `project()` command gained new `COMPAT_VERSION` and `SPDX_LICENSE` options. These values may be inherited when creating a CPS package description. See the `install(PACKAGE_INFO)` documentation for details.

### 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.

### Presets

- `cmake-presets(7)` files now support schema version `11`. The `jobs` field under test presets now supports an empty string, to match the behavior of `ctest --parallel` with the value omitted.

- The `jobs` field under both build and test presets no longer accept negative integer values, regardless of the schema version.

### 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 new `interfaceSources` array field, and the `sourceGroups` array items gained a new `interfaceSourceIndexes` array field.

### Platforms

- `HIP` language code may now be compiled for SPIR-V targets, e.g., via chipStar. See the `CMAKE_HIP_PLATFORM` variable.

### Command-Line

- `cmake --version` now supports a `=json-v1` value to print detailed version information in a JSON format.

- `cmake --build` now supports specifying a build directory and preset together. The build preset will be used with the explicit build directory substituted.

- The `cmake -E` commands `md5sum`, `sha1sum`, `sha224sum`, `sha256sum`, `sha384sum`, and `sha512sum` now support reading from standard input by passing `-`.

- The `cmake -E bin2c` command-line tool was added.

- The `cmake -E tar` command-line tool:

  - Gained a `--cmake-tar-compression-level` flag to specify the compression level.

  - Gained a `--cmake-tar-compression-method` flag to specify the compression method.

  - Gained a `--cmake-tar-threads` flag to enable multithreaded operations.

  - Now supports specifying compression method and level for `7zip` and `zip` formats.

  - Gained a `--format=raw` flag to disable compression.

  - Gained a `--lzma` flag to specify `LZMA` compression.

### Commands

- The `cmake_instrumentation()` command was added to make project-level instrumentation queries.

- The `file(ARCHIVE_CREATE)` command:

  - Gained a `THREADS` option to enable multithreaded operations.

  - Now supports `COMPRESSION` method `Deflate` as an alias for `GZip`.

  - Now supports `COMPRESSION` method `LZMA`.

  - Now supports `COMPRESSION` method `LZMA2` as an alias for `XZ`.

  - Now supports `COMPRESSION` method `PPMd` for format `7zip`.

  - Now supports `COMPRESSION` and `COMPRESSION_LEVEL` options for formats `7zip` and `zip`.

- The `get_property()` and `set_property()` commands now support a `FILE_SET` scope for file set properties of a target.

- The `string(JSON)` command gained new `GET_RAW` and `STRING_ENCODE` modes.

- The `source_group()` command now supports `generator expressions`.

- The `cmake_host_system_information()` command gained a `LOCALE_CHARSET` query for the expected `cmake-language(7)` script encoding.

### Variables

- The `CMAKE_<LANG>_LINK_FLAGS` and `CMAKE_<LANG>_LINK_FLAGS_<CONFIG>` variables were added to support per-language link flags for all target types. See policy `CMP0210`.

- The `CMAKE_VERIFY_PRIVATE_HEADER_SETS` variable and corresponding `VERIFY_PRIVATE_HEADER_SETS` target 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_STUDIO` target property and supporting `CMAKE_<LANG>_PVS_STUDIO` variable were introduced to tell Makefile Generators and Ninja Generators to run `pvs-studio-analyzer` with the compiler for `C` and `CXX` languages.

- When `VERIFY_INTERFACE_HEADER_SETS` is set to true on an executable target, that target's interface file sets are verified regardless of its `ENABLE_EXPORTS` property. See policy `CMP0209`.

- The `PRIVATE_HEADER_SETS_TO_VERIFY` target property was added to customize which private file sets to verify when the target's `VERIFY_PRIVATE_HEADER_SETS` property is true.

### Modules

- The `FindCUDAToolkit` module now creates a `CUDA::bin2c` imported target for the bin2c utility.

- The `FindLibXml2` module gained a `LibXml2_USE_STATIC_LIBS` hint to select static libraries.

- The `FindRuby` module now provides imported targets.

- The `FindSQLite3` module now provides imported targets with the `SQLite3::` prefix.

- The `UseJava` module's `add_jar()` command now accepts a new `INCLUDE_MODULES` option that adds its arguments to the `--module-path` argument 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 `CTestCoverageCollectGCOV` module:

  - Now supports `TARBALL_COMPRESSION` method `LZMA`.

  - Now supports `TARBALL_COMPRESSION` method `LZMA2` as an alias for `XZ`.

  - Now supports `FROM_EXT` with file extensions corresponding to `LZMA` and `ZSTD` compression.

### CPack

- `CPack` gained the `CPACK_COMPRESSION_LEVEL` variable to control the compression level used when creating packages.

- The `CPack Archive Generator`:

  - Now supports compression method specification for formats `7zip` and `zip`.

  - Gained a `CPACK_ARCHIVE_COMPRESSION_LEVEL` option to control the compression level used when creating archive packages.

  - Gained `CPACK_ARCHIVE_UID` and `CPACK_ARCHIVE_GID` options to specify the UID and GID of archive entries, respectively. The defaults are UID `0` and GID `0`. See policy `CMP0206`.

- The `CPack DEB Generator` gained a new `CPACK_DEBIAN_COMPRESSION_LEVEL` variable to control the compression level used when creating Debian packages.

- The `CPack WIX Generator` now supports per-user installers by setting `CPACK_WIX_INSTALL_SCOPE` to `perUser`.

## Deprecated and Removed Features

- The `CMAKE_ENABLE_EXPORTS` variable is deprecated in favor of the `CMAKE_EXECUTABLE_ENABLE_EXPORTS` and `CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS` variables.

- The `export(EXPORT)` command no longer allows certain arguments to be missing or empty. See policy `CMP0208`.

## Other Changes

- The `cmake -E tar` command-line tool and the `file(ARCHIVE_EXTRACT)` command now reject archive entries whose paths are absolute or contain `..` path traversal components.

- The family of `cmake --trace` and related commands now print "end" commands for control structures: `endblock()`, `endforeach()`, `endfunction()`, `endif()`, `endmacro()`, and `endwhile()`.

- The `file(CREATE_LINK)` command's `COPY_ON_ERROR` option, when used with a directory, now copies directory content. See policy `CMP0205`.

- The `file(GET_RUNTIME_DEPENDENCIES)` and `install(RUNTIME_DEPENDENCY_SET)` commands now normalize paths before matching filters. See policy `CMP0207`.

- The precompiled Linux `aarch64` binaries provided on cmake.org now require GLIBC 2.28 or higher.

- The precompiled macOS binary provided on `cmake.org` for macOS 10.13+ now requires macOS 12 or newer for the `cmake-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.

## Updates

Changes made since CMake 4.3.0 include the following.

### 4.3.1, 4.3.2

- These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions.

### 4.3.3

- The `export(PACKAGE_INFO)` command now writes to the `cps/<package-name>` subdirectory of the current build directory, rather than directly to the current build directory.

### 4.3.4

- `cmake-instrumentation(7)`, introduced in 4.3.0, has been changed to generate index files and snippet files with a new `version` field format. It is now an object with major and minor version components, `{ "major": 1, "minor": 0 }`. Previously it was an integer with only the major version, `1`.