CMake 4.3 brings Common Package Specification and build profiling
CMake 4.3 can import and export packages in the JSON-based CPS format. A new instrumentation feature aids in build profiling.
(Image: Nice to meet you / Shutterstock.com)
Kitware has released version 4.3 of its widely used build system, CMake. The most important new feature is support for the Common Package Specification (CPS), a JSON-based format that describes software packages in a vendor-neutral way. Additionally, the release introduces an instrumentation framework that allows developers to capture timing data and system diagnostics throughout the entire build process.
The build system CMake is considered the de facto standard for C and C++ projects and is used in numerous open-source as well as commercial projects. Previously, package descriptions could only be exchanged in CMake's own language. The CPS specification is currently at version 0.14.1 and aims to improve interoperability between different build systems by enabling package descriptions to be exchanged in a format that, according to Kitware's announcement, is not tied to CMake's proprietary language.
Common Package Specification: Package descriptions beyond CMake syntax
The Common Package Specification describes binary packages – i.e., libraries, headers, and tools – in a machine-readable JSON format that works independently of the specific build system. CPS files contain information about interface targets, supported configurations per architecture, version compatibility, and license details. This allows build systems like CMake, as well as package managers like Conan, to use the same package descriptions without having to translate them into a proprietary format.
Specifically, Kitware has created three central integration points in CMake 4.3: The find_package() command now also searches for and can import CPS packages. The install() and export() commands have received a new subcommand PACKAGE_INFO, which allows CPS descriptions to be generated. Furthermore, the project() command now understands the COMPAT_VERSION and SPDX_LICENSE options, which are automatically adopted during CPS generation. Experimental CPS support was already available in earlier 4.x versions; with CMake 4.3, the feature is now considered stable, according to the Release Notes.
Videos by heise
Instrumentation: Analyzing build processes
For those who want to know where build time is actually spent, cmake-instrumentation(7) offers a new tool. The framework collects granular data on runtimes, exit codes, and system metrics such as CPU utilization and memory consumption during all phases: configuration, generation, compilation, testing, and installation. The measurements are saved in indexed snippet files in the build directory and can be further processed via callbacks.
Particularly useful for analysis: CMake 4.3 can output instrumentation data in the Google Trace Event Format. This allows build workflows to be visualized in common trace viewers like Perfetto – bottlenecks in compilation or linking become visible at a glance. Additionally, the data is fed into CDash submissions, enabling teams to monitor their build performance even in CI/CD operations. Activation can be done either via the new cmake_instrumentation() command or via JSON-based query files at the project or user level.
Other new features at a glance
In addition to these two highlights, CMake 4.3 brings numerous other improvements. Archive operations via cmake -E tar and file(ARCHIVE_CREATE) now support multithreading via a new --cmake-tar-threads flag, additional compression methods like LZMA and PPMd for the 7zip format, and configurable compression levels. The new command-line tool cmake -E bin2c converts binary files into C headers.
Relevant for GPU developers: HIP code can now be compiled for SPIR-V targets, for example, via the chipStar project. On the command line, cmake --version =json-v1 outputs detailed version information in JSON format, and cmake --build now allows specifying the build directory and preset together. New generator expressions $<STRING:…> expand the possibilities for string operations in build scripts. Preset files support schema version 11, and the File-Based API has been updated to Codemodel version 2.10.
New variables CMAKE_<LANG>_LINK_FLAGS and CMAKE_<LANG>_LINK_FLAGS_<CONFIG> enable language-specific linker flags for all target types. A complete overview of all changes in CMake 4.3 can be found in the Release Notes. The new version is available for download as a binary package for Windows, macOS, and Linux from the official download page.
(map)