CMake 4.0 Release Notes

Changes made since CMake 3.31 include the following.

New Features

File-Based API

  • The cmake-file-api(7) "codemodel" version 2 version field has been updated to 2.8.

  • The cmake-file-api(7) "codemodel" version 2 "target" object gained a new debugger field.

Command-Line

Commands

Variables

Properties

Modules

Generator Expressions

  • The $<PATH> generator expression gained the NATIVE_PATH operation to convert a CMake path into a native one.

CTest

  • The ctest --interactive-debug-mode option on Windows now enables Windows Error Reporting by default in test processes, allowing them to creating debug popup windows and core dumps. This restores behavior previously removed by CMake 3.11 after updates to libuv made it possible.

CPack

Deprecated and Removed Features

Other Changes

  • On macOS with Ninja Generators and Makefile Generators, when a compiler is found in /usr/bin, it is now used as-is and is no longer mapped to the corresponding compiler inside Xcode. The mapping was introduced by CMake 3.2 to allow build trees to continue to work with their original compiler even when xcode-select switches to a different Xcode installation. However, the compilers inside Xcode cannot be used without explicit -isysroot flags and are therefore not suitable for passing to arbitrary third-party build systems. Furthermore, the mapping behavior can override user-specified compiler paths. Therefore, this behavior has been reverted.

  • In builds targeting macOS, CMAKE_OSX_SYSROOT now defaults to empty, deferring to the compiler's default macOS SDK selection. In order to pass an explicit macOS SDK via the compiler's -isysroot flag, users may configure their build tree with -DCMAKE_OSX_SYSROOT=macosx, or export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" in their environment.

    Notes:

    • macOS compilers in /usr/bin, when not invoked with -isysroot, search for headers in /usr/local/include before system SDK paths, matching the convention on many platforms. Users on macOS-x86_64 hosts with Homebrew installed in /usr/local should pass an explicit SDK, as described above, when not building with Homebrew tools.

    • Some Clang compilers have no default macOS SDK selection. For these, if CMAKE_OSX_SYSROOT is empty, CMake will automatically pass -isysroot with the macOS SDK printed by xcrun --show-sdk-path.

  • On Windows, file paths named in project code, e.g., in CMakeLists.txt, are no longer automatically converted to their on-disk upper/lower case. Projects are expected to spell source file paths consistently using their canonical case, e.g., in calls to add_library(), set_property(SOURCE), or set_source_files_properties(). This matches the behavior on platforms with case-sensitive filesystems.

  • On AIX, SHARED library targets now produce a shared library archive by default. See policy CMP0182.

  • The cmake --preset command no longer outputs a summary of the preset's CMake cache and environment variables by default. That summary is now only shown when the message log level is set to VERBOSE, DEBUG, or TRACE via the cmake --log-level option or the CMAKE_MESSAGE_LOG_LEVEL cache variable.

  • Precompiled SunOS sparc64 and x86_64 binaries are now provided on cmake.org.

Updates

Changes made since CMake 4.0.0 include the following.

4.0.1

  • This version made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions.

4.0.2

  • When building for macOS with a Clang that has no default macOS SDK, if CMAKE_OSX_SYSROOT is empty, CMake now automatically passes -isysroot with the macOS SDK printed by xcrun --show-sdk-path. This restores support for using LLVM/Clang on macOS without manually setting CMAKE_OSX_SYSROOT, which was broken by CMake 4.0.0's removal of a default value.

  • The DEBUGGER_WORKING_DIRECTORY target property is now used by the Xcode generator as a fallback for the XCODE_SCHEME_WORKING_DIRECTORY target property.