CMake 4.0 Release Notes
***********************
.. only:: html
.. contents::
Changes made since CMake 3.31 include the following.
New Features
============
File-Based API
--------------
* The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has
been updated to 2.8.
* The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object
gained a new ``debugger`` field.
Command-Line
------------
* The :option:`cmake --link-no-warning-as-error` option was added to suppress
the effects of the :prop_tgt:`LINK_WARNING_AS_ERROR` target property and
:variable:`CMAKE_LINK_WARNING_AS_ERROR` variable.
* The :option:`cmake --project-file` option was added to specify an alternate
filename for ``CMakeLists.txt`` files. This is intended for temporary use
by developers during an incremental transition and not for publication of a
final product. CMake will always emit a warning when the project file is
anything other than ``CMakeLists.txt``.
* The :option:`cmake --sarif-output` option was added to enable generation of a
`Static Analysis Results Interchange Format (SARIF)
`_ log file recording diagnostic
messages from the run.
Commands
--------
* The :command:`target_link_libraries` command now supports the ``LINKER:``
prefix.
Variables
---------
* The :variable:`AIX` and :variable:`CMAKE_HOST_AIX` variables are
now set to true when the target or host system is AIX, respectively.
* Linker flag variables learned to support the ``LINKER:`` prefix:
* :variable:`CMAKE_EXE_LINKER_FLAGS`
* :variable:`CMAKE_EXE_LINKER_FLAGS_`
* :variable:`CMAKE_SHARED_LINKER_FLAGS`
* :variable:`CMAKE_SHARED_LINKER_FLAGS_`
* :variable:`CMAKE_MODULE_LINKER_FLAGS`
* :variable:`CMAKE_MODULE_LINKER_FLAGS_`
See policy :policy:`CMP0181`.
* The :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL` variable
was added to specify the :command:`execute_process` command's
default ``COMMAND_ERROR_IS_FATAL`` behavior.
* The :variable:`CMAKE_EXPORT_SARIF` variable was added to enable generation of
a SARIF log file listing diagnostics recorded during configuration and
generation of a CMake project.
* The :variable:`CMAKE__LINK_MODE` and
:variable:`CMAKE__DEVICE_LINK_MODE` variables were added to provide
information on how the link step is done.
* The :variable:`CMAKE_LINK_WARNING_AS_ERROR` variable and corresponding
:prop_tgt:`LINK_WARNING_AS_ERROR` target property were added to link
using a linker-specific flag to treat warnings as errors.
* The :variable:`CMAKE_MSVC_RUNTIME_CHECKS` variable and
:prop_tgt:`MSVC_RUNTIME_CHECKS` target property were introduced
to select runtime checks for compilers targeting the MSVC ABI.
See policy :policy:`CMP0184`.
* The :variable:`CMAKE_POLICY_VERSION_MINIMUM` variable was added to
help packagers and end users try to configure existing projects that
have not been updated to work with supported CMake versions.
The :envvar:`CMAKE_POLICY_VERSION_MINIMUM` environment variable was
added to initialize it.
* The :variable:`CMAKE_UNITY_BUILD_RELOCATABLE` variable and corresponding
:prop_tgt:`UNITY_BUILD_RELOCATABLE` target property were added to make
sources generated for :variable:`CMAKE_UNITY_BUILD` to ``#include`` the
original source files using relative paths where possible.
* The :variable:`CMAKE_XCODE_SCHEME_LLDB_INIT_FILE` variable and corresponding
:prop_tgt:`XCODE_SCHEME_LLDB_INIT_FILE` target property were added to tell
the :generator:`Xcode` generator what to put in the scheme's "LLDB Init File"
setting.
* The :variable:`CMAKE_XCODE_SCHEME_TEST_CONFIGURATION` variable and corresponding
:prop_tgt:`XCODE_SCHEME_TEST_CONFIGURATION` target property were added to tell
the :generator:`Xcode` generator what to put in the scheme's "Build Configuration"
setting for the test action.
Properties
----------
* The :prop_tgt:`DEBUGGER_WORKING_DIRECTORY` target property and corresponding
:variable:`CMAKE_DEBUGGER_WORKING_DIRECTORY` variable were added to tell
generators what debugger working directory should be set for targets.
* The :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property now supports an
``ARCHIVER:`` prefix to pass options to the archiver through the compiler
driver in a portable way.
* The :prop_tgt:`Swift_MODULE_DIRECTORY` target property now supports
:manual:`generator expressions `.
* The :prop_sf:`VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD` source file property
was added to tell :ref:`Visual Studio Generators` not to run a custom command
in parallel.
* The :prop_dir:`VS_SOLUTION_ITEMS` directory property was added
to tell :ref:`Visual Studio Generators` to attach files directly
to the Solution (``.sln``).
Modules
-------
* The :module:`ExternalData` module gained a
:variable:`ExternalData_HTTPHEADERS` variable to specify HTTP headers.
* The :module:`ExternalProject` module's :command:`ExternalProject_Add`
command gained an ``INSTALL_JOB_SERVER_AWARE`` option to enable
integration of the GNU Make job server when using an explicit
``INSTALL_COMMAND`` with :ref:`Makefile Generators`.
* The :module:`FeatureSummary` module :command:`add_feature_info`
command now supports full :ref:`Condition Syntax`.
See policy :policy:`CMP0183`.
* The :module:`FindBISON` module :command:`bison_target` command gained an
``OPTIONS`` option to specify Bison command-line options.
* The :module:`FindCURL` module now provides a ``CURL_VERSION`` result
variable to match upstream cURL's CMake package.
* The :module:`FindFLEX` module :command:`flex_target` command gained an
``OPTIONS`` option to specify Flex command-line options.
* The :module:`FindPatch` module now supports running in
:ref:`cmake -P