# CMake 4.1 Release Notes

Changes made since CMake 4.0 include the following.

## New Features

### File-Based API

- The `cmake-file-api(7)` v1 now writes partial replies when buildsystem generation fails with an error. See the v1 Reply Error Index.

### Generators

- Makefile Generators and Ninja Generators gained support for adding a linker launcher with `Fortran`, `CUDA`, and `HIP`. See the `CMAKE_<LANG>_LINKER_LAUNCHER` variable and `<LANG>_LINKER_LAUNCHER` target property for details.

### Command-Line

- The cmake --build command-line tool, when used with the `Xcode` generator, now detects when a third-party tool has wrapped the generated `.xcodeproj` in a `.xcworkspace`, and drives the build through the workspace instead.

### Configure Log

- The `cmake-configure-log(7)` now reports events from `find_package()` (in `CONFIG` mode), `find_path()`, `find_file()`, `find_library()`, and `find_program()` commands when first invoked, when their results transition between "not found" and "found", or when enabled explicitly by the `--debug-find` command-line option. See Event Kind find and Event Kind find_package. Logging may also be controlled by the `CMAKE_FIND_DEBUG_MODE` and `CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG` variables.

### Compilers

- Diab compilers from Wind River Systems, versions 5.9.x+, are now supported with `compiler id` `Diab` for languages `ASM`, `C`, and `CXX`.

- Renesas Compilers are now supported with `compiler id` `Renesas` for languages `ASM` and `C`.

### Commands

- The `add_dependencies()` command may be called with no dependencies.

- The `cmake_pkg_config()` command now supports the `IMPORT` and `POPULATE` subcommands for interfacing CMake targets with pkg-config based dependencies.

- The `project()` command now has experimental support for the `COMPAT_VERSION` keyword, gated by `CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO`.

### Variables

- The `CMAKE_FIND_REQUIRED` variable was added to tell `find_package()`, `find_path()`, `find_file()`, `find_library()`, and `find_program()` to be `REQUIRED` by default. The commands also gained an `OPTIONAL` keyword to ignore the variable for a specific call.

- The `CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID` variable is now populated for most compilers, and documented for public use.

- The `CMAKE_<LANG>_ICSTAT` variable and corresponding `<LANG>_ICSTAT` target property were added to tell the Makefile Generators and the Ninja Generators to run the IAR `icstat` tool along with the compiler for `C` and `CXX` languages.

### Environment Variables

- The `CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES_EXCLUDE` environment variable was added to optionally exclude specific libraries from the detected set of `CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES`.

### Properties

- The `AUTOMOC_INCLUDE_DIRECTORIES` target property and associated `CMAKE_AUTOMOC_INCLUDE_DIRECTORIES` variable were added to override the automatic discovery of moc includes from a target's transitive include directories.

- The `MACOSX_PACKAGE_LOCATION` source file property now works when set on a source directory, and copies its entire tree into the bundle.

- The `PDB_NAME` and `COMPILE_PDB_NAME` target properties now support `generator expressions`.

### Modules

- The `FindASPELL` module now provides a version variable, imported targets, and components to optionally select the Aspell library and executable separately.

- The `FindBLAS` and `FindLAPACK` modules now support the NVIDIA Performance Libraries (NVPL).

- The `FindProtobuf` module's `protobuf_generate(DEPENDENCIES)` command argument now accepts multiple values.

- The `FindProtobuf` module's `protobuf_generate_cpp()` and `protobuf_generate_python()` commands, together with their `Protobuf_IMPORT_DIRS` and `PROTOBUF_GENERATE_CPP_APPEND_PATH` hint variables, are now deprecated in favor of the `protobuf_generate()` command.

### Regular Expressions

- The `string(REGEX MATCHALL)`, `string(REGEX REPLACE)`, and `list(TRANSFORM REPLACE)` commands now match the regular expression `^` anchor at most once in repeated searches, at the start of the input. See policy `CMP0186`.

- The `string(REGEX REPLACE)` command now allows references to unmatched groups. They are replaced with empty strings.

- The `string(REGEX MATCH)`, `string(REGEX MATCHALL)`, and `string(REGEX REPLACE)` commands now allow zero-length matches.

### CTest

- `ctest(1)` gained a `--schedule-random-seed` option to specify a numeric random seed to make `ctest --schedule-random` deterministic for reproduction.

### CPack

- The `CPack NuGet Generator` gained option `CPACK_NUGET_SYMBOL_PACKAGE` to generate NuGet symbol packages containing PDB files.

- The `CPack RPM Generator` gained `CPACK_RPM_PACKAGE_ENHANCES`, `CPACK_RPM_PACKAGE_RECOMMENDS`, and `CPACK_RPM_PACKAGE_SUPPLEMENTS` variables to specify the corresponding RPM spec fields.

## Deprecated and Removed Features

- The `FindGTest` module's result variables `GTEST_INCLUDE_DIRS`, `GTEST_LIBRARIES`, `GTEST_MAIN_LIBRARIES`, and `GTEST_BOTH_LIBRARIES` are now deprecated in favor of using `GTest::gtest` and `GTest::gtest_main` imported targets.

- The `FindGCCXML` module has been deprecated via policy `CMP0188`. Port projects to CastXML instead.

- The `FindCABLE` module has been deprecated via policy `CMP0191`.

- The `CMakeDetermineVSServicePack` module has been deprecated via policy `CMP0196`. Port projects to the `CMAKE_<LANG>_COMPILER_VERSION` variable instead.

## Other Changes

- The `ExternalProject` module no longer checks the `URL` archive file extension. Any archive type that `cmake -E tar` can extract is now allowed.

- Modules `FindPython3`, `FindPython2` and `FindPython` now enforce consistency of artifacts in cross-compiling mode. This prevents mixing host and target artifacts. See policy `CMP0190`.

- The `GNUInstallDirs` module now prefers to default `SYSCONFDIR`, `LOCALSTATEDIR`, and `RUNSTATEDIR` to absolute paths when installing to special prefixes. See policy `CMP0192`.

- The `GNUInstallDirs` module now caches `CMAKE_INSTALL_*` variables with their leading `usr/` for install prefix `/`. See policy `CMP0193`.

- The `install(TARGETS)` command no longer ignores file sets which haven't been defined at the point it is called. The ordering of `target_sources(FILE_SET)` and `install(TARGETS)` is no longer semantically relevant.

- Enabling `ASM` no longer accidentally succeeds using `MSVC`'s `cl` C compiler as an assembler. See policy `CMP0194`.

- The MSVC link `-machine:` flag is no longer added to the `CMAKE_*_LINKER_FLAGS` variables. See policy `CMP0197`.

- The `TARGET_PROPERTY` generator expression now evaluates the `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` target properties transitively. See policy `CMP0189`.

## Updates

Changes made since CMake 4.1.0 include the following.

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

- The `file(GENERATE)` command, when evaluating generator expressions, now uses the value of policy `CMP0189` as of each call site. Previously, it used the value as of the end of the directory's `CMakeLists.txt`, as all other generator expression evaluations do.

### 4.1.3

- When building for macOS with the `Xcode` generator, `CMAKE_OSX_DEPLOYMENT_TARGET` once again defaults to the host's macOS version if it is older than the macOS SDK version, as it did in CMake versions prior to 4.0.

- The `execute_process()` command once again terminates child processes when its `TIMEOUT` is reached. This was accidentally regressed by CMake 3.29.