1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
|
CMake 4.2 Release Notes
***********************
.. only:: html
.. contents::
Changes made since CMake 4.1 include the following.
New Features
============
File-Based API
--------------
* The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has
been updated to 2.9.
* The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" and
"directory" objects gained a new ``codemodelVersion`` field.
* The :manual:`cmake-file-api(7)` "codemodel" version 2 now includes imported
targets and all interface library targets in its replies. Previously,
imported targets were omitted, and only those interface targets that
participated in the build system were included. The following changes
support these new additions:
* The "target" object gained ``imported``, ``local``, and ``abstract`` fields.
* The "target" object's ``type`` field can now also hold the value
``UNKNOWN_LIBRARY``.
* The "codemodel" object's ``configurations`` entries gained a new
``abstractTargets`` array.
* Entries in the ``directories`` and ``projects`` arrays of the "codemodel"
object's ``configurations`` entries gained a new ``abstractTargetIndexes``
array.
* The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object gained
new ``linkLibraries``, ``interfaceLinkLibraries``, ``compileDependencies``,
``interfaceCompileDependencies``, ``objectDependencies``, and
``orderDependencies`` fields.
Generators
----------
* The :generator:`Visual Studio 18 2026` generator was added.
* The :generator:`FASTBuild` generator was added.
Platforms
---------
* CMake now supports :ref:`Cross Compiling for Emscripten` with simple
toolchain files.
Command-Line
------------
* The :manual:`cmake(1)` command-line tool now supports
``cmake -E copy_if_newer`` and ``cmake -E copy_directory_if_newer``
subcommands to copy files based on timestamp comparison instead of
content comparison. These commands copy files only if the source is
newer than the destination, providing better performance for build
systems compared to ``copy_if_different`` which compares file contents.
Commands
--------
* The :command:`cmake_language(TRACE)` command was added to enable or
disable tracing during script execution.
* The :command:`set(CACHE{<variable>}) <set(CACHE)>` and
:command:`unset(CACHE{<variable>}) <unset(CACHE)>` commands were added to
explicitly set and unset cache entries.
* The :command:`string(REGEX QUOTE)` command was added to
generate a regular expression exactly matching a string.
Variables
---------
* The :variable:`CMAKE_CXX_STDLIB_MODULES_JSON` variable was added to set
the path to the ``import std`` metadata file for the standard library
rather than using the compiler to discover its location.
* The :variable:`CMAKE_INTERMEDIATE_DIR_STRATEGY` variable and corresponding
:envvar:`CMAKE_INTERMEDIATE_DIR_STRATEGY` environment variable were added
to change the strategy used to name intermediate directories used for
object files and other associated target metadata.
* The :variable:`CMAKE_AUTOGEN_INTERMEDIATE_DIR_STRATEGY` variable and
corresponding :envvar:`CMAKE_AUTOGEN_INTERMEDIATE_DIR_STRATEGY` environment
variable were added to change the strategy used to name intermediate
directories used for :manual:`Qt Autogen <cmake-qt(7)>` files.
* The :variable:`CMAKE_SKIP_LINTING` variable and corresponding
:prop_tgt:`SKIP_LINTING` target property were added to tell the
:ref:`Command-Line Build Tool Generators` to skip linting all
sources in a target.
Properties
----------
* The :prop_sf:`INSTALL_OBJECT_NAME` source file property was added to
control names of installed object files for specific compiled sources.
* The :prop_tgt:`INSTALL_OBJECT_NAME_STRATEGY` target property was added
to control the naming strategy for installed object files.
* The :prop_tgt:`INSTALL_OBJECT_ONLY_USE_DESTINATION` target property was
added to more precisely control the installation path for object files.
* The :prop_sf:`JOB_POOL_COMPILE` source file property was added
to assign individual source compilations to :prop_gbl:`JOB_POOLS`.
* The :prop_sf:`OBJECT_NAME` source file property was added to control
object names of compiled source files.
* The :prop_tgt:`UNITY_BUILD_FILENAME_PREFIX` target property was added
to control names of source files generated by :prop_tgt:`UNITY_BUILD`.
Modules
-------
* Nearly all find modules now provide a ``<PackageName>_VERSION`` result
variable matching the casing of its module name. Existing variants such as
``<PackageName>_VERSION_STRING`` and uppercased ``<PACKAGENAME>_VERSION``
are deprecated. See documentation of each find module for details.
* The :module:`CheckTypeSize` module's :command:`check_type_size` command
gained a new ``RESULT_VARIABLE`` keyword to customize the result variable
name instead of the default ``HAVE_<size-var>``.
* The :module:`ExternalProject` module's :command:`ExternalProject_Add`
and :command:`ExternalProject_Add_Step` commands now provide options to set
environment variables on the configure, build, install, and test steps.
* The :module:`FindPython3`, :module:`FindPython2`, and :module:`FindPython`
modules no longer make ``NumPy`` depend on ``Development.Module``.
See policy :policy:`CMP0201`.
* The :module:`GoogleTest` module's :command:`gtest_discover_tests()`
command now sets the ``DEF_SOURCE_LINE`` test property for each
discovered test if gtest supports the ``--gtest_output=json`` option.
This test property is used by some IDEs to locate the source for each test.
* The :module:`UseSWIG` module's :command:`swig_add_library` command gained a
``DEBUG_POSTFIX`` option to control the :prop_tgt:`DEBUG_POSTFIX` target
property.
Generator Expressions
---------------------
* The :genex:`<LANG>_COMPILER_LINKER_ID <C_COMPILER_LINKER_ID>` and
:genex:`<LANG>_COMPILER_LINKER_FRONTEND_VARIANT <C_COMPILER_LINKER_FRONTEND_VARIANT>`
families of generator expressions were added to access the value of the
associated :variable:`CMAKE_<LANG>_COMPILER_LINKER_ID` and
:variable:`CMAKE_<LANG>_COMPILER_LINKER_FRONTEND_VARIANT` variables.
* The :genex:`TARGET_FILE_BASE_NAME`, :genex:`TARGET_IMPORT_FILE_BASE_NAME`,
:genex:`TARGET_LINKER_FILE_BASE_NAME`,
:genex:`TARGET_LINKER_LIBRARY_FILE_BASE_NAME`,
:genex:`TARGET_LINKER_IMPORT_FILE_BASE_NAME`, and
:genex:`TARGET_PDB_FILE_BASE_NAME`
generator expressions gained a ``POSTFIX`` option to control the inclusion
of the :prop_tgt:`<CONFIG>_POSTFIX` target property as part of the base
names of the corresponding files.
* The :genex:`TARGET_INTERMEDIATE_DIR` generator expression was
added to refer to a target's intermediate files directory in
the build tree.
CPack
-----
* The :cpack_gen:`CPack AppImage Generator` was added.
* The :variable:`CPACK_PACKAGE_CHECKSUM` variable now supports multiple values.
* The :cpack_gen:`CPack NSIS Generator` gained a
:variable:`CPACK_NSIS_CRC_CHECK` variable for setting the ``CRCCheck``
attribute.
* The :cpack_gen:`CPack WIX Generator` gained a
:variable:`CPACK_WIX_CAB_PER_COMPONENT` variable to enable one ``.cab``
per component.
Deprecated and Removed Features
===============================
* All find modules now provide a ``<PackageName>_FOUND`` result variable
matching the casing of its module name. Existing variants, such as the
uppercased ``<PACKAGENAME>_FOUND``, are deprecated where appropriate.
See documentation of each find module for details.
* The :module:`FindwxWidgets` module's result variable
``wxWidgets_USE_FILE`` is now deprecated in favor of including the
:module:`UsewxWidgets` module directly.
* The :generator:`Visual Studio 14 2015` generator is now deprecated
and will be removed in a future version of CMake.
Other Changes
=============
* The :genex:`$<CONFIG:cfgs>` generator expression, when appearing on an
imported target, has been fixed to only match the configuration actually
being consumed. See policy :policy:`CMP0199`.
* Selection of configuration and location of imported targets is now more
consistent. See policy :policy:`CMP0200`.
* The :variable:`CMAKE_PARENT_LIST_FILE` variable is no longer defined when
processing a ``CMakeLists.txt`` file. See policy :policy:`CMP0198`.
* For builds targeting the MSVC ABI, all generators now add the ``_MBCS``
preprocessor definition when compiling sources unless ``_UNICODE`` or
``_SBCS`` is found. See policy :policy:`CMP0204`.
* For builds targeting the MSVC ABI, all generators now add the ``_WINDLL``
preprocessor definition when compiling sources in shared libraries.
See policy :policy:`CMP0203`.
* The :ref:`Visual Studio Generators` now suppress Visual Studio's default
flags ``-fp:precise``, ``-Gd``, and ``-GS`` if they are not specified by
the project or user. This makes builds more consistent with other
generators, and with what projects and users actually specify.
Updates
=======
Changes made since CMake 4.2.0 include the following.
4.2.1
-----
* This version made no changes to documented features or interfaces.
Some implementation updates were made to support ecosystem changes
and/or fix regressions.
|