9317e51ae1e228907789aba4d68e5e233b8ae891
[platform/upstream/cmake.git] / Help / release / 3.24.rst
1 CMake 3.24 Release Notes
2 ************************
3
4 .. only:: html
5
6   .. contents::
7
8 Changes made since CMake 3.23 include the following.
9
10 New Features
11 ============
12
13 Presets
14 -------
15
16 * :manual:`cmake-presets(7)` files now support schema version ``5``.
17
18 * :manual:`cmake-presets(7)` files now support a ``${pathListSep}`` macro,
19   which expands to ``:`` or ``;`` based on the platform.
20
21 * :manual:`cmake-presets(7)` files gained support for specifying a
22   ``testOutputTruncation`` field in test presets, which specifies the
23   truncation mode once the maximum test output size has been reached.
24
25 Generators
26 ----------
27
28 * The :generator:`Green Hills MULTI` generator now generates build
29   rules to re-run CMake if any CMake files are updated.
30
31 * The :ref:`Visual Studio Generators` now support ``SYSTEM`` headers
32   when using VS 2019 Update 11 or later.
33
34 Command-Line
35 ------------
36
37 * :manual:`cmake(1)` gained the ``--fresh`` command-line option to remove
38   any existing ``CMakeCache.txt`` file and associated ``CMakeFiles/``
39   directory, when configuring a build tree, thus starting a new configuration
40   as if the build tree were freshly created.
41
42 * :manual:`cmake(1)` gained the ``--compile-no-warning-as-error`` command-line
43   option which causes the effects of the :prop_tgt:`COMPILE_WARNING_AS_ERROR`
44   target property and :variable:`CMAKE_COMPILE_WARNING_AS_ERROR` variable
45   to be ignored.
46
47 * The :manual:`cmake(1)` ``--trace=json-v1`` trace format gained fields
48   ``global_frame`` and ``line_end``.
49
50 * The :manual:`cmake(1)` ``-E`` commands ``cat`` and ``env`` learned to respect
51   a double dash (``--``) argument that acts as a delimiter indicating the end of
52   options. Any following arguments are treated as operands/positional arguments,
53   even if they begin with a dash ``-`` character.
54
55 * The :manual:`cmake(1)` ``-E tar`` command gained the ``--touch`` option
56   to keep the current local timestamp instead of extracting file timestamps
57   from the archive.
58
59 Compilers
60 ---------
61
62 * LLVM's `flang`_ Fortran compiler is now supported on some platforms,
63   with compiler id ``LLVMFlang``.
64
65 .. _`flang`: https://github.com/llvm/llvm-project/tree/main/flang
66
67 * ADSP compiler support (SHARC and Blackfin) now covers both CCES and
68   VDSP++ installations, with required configuration now done in the
69   compiler module itself rather than the ``Generic-ADSP`` platform module.
70
71 Platforms
72 ---------
73
74 * A dedicated ``ADSP`` platform has been added
75   to replace the existing ``Generic-ADSP`` implementation.
76   This features automatic detection of the latest CCES/VDSP++ install
77   and compiler selection (``cc21k`` vs. ``ccblkfn``)
78   based off of the :variable:`CMAKE_SYSTEM_PROCESSOR` variable.
79
80 Commands
81 --------
82
83 * The :command:`cmake_host_system_information` command, on Windows,
84   gained a ``QUERY WINDOWS_REGISTRY`` mode.
85   See its :ref:`Query Windows registry` section.
86
87 * The :command:`cmake_language` command gained a new
88   ``SET_DEPENDENCY_PROVIDER`` sub-command.  When a dependency provider is set,
89   calls to :command:`find_package` and :command:`FetchContent_MakeAvailable`
90   can be redirected through a custom command, which can choose to fulfill the
91   request directly, modify how the request is processed, or leave it to be
92   fulfilled by the built-in implementation.  See :ref:`dependency_providers`.
93
94 * The :command:`file(DOWNLOAD)` command gained options ``RANGE_START`` and
95   ``RANGE_END`` to specify a range of bytes to download.  This can be
96   useful for downloading parts of big binary files.
97
98 * The :command:`find_file`, :command:`find_path`, :command:`find_library`,
99   :command:`find_program`, and :command:`find_package` commands gained the
100   ``NO_CMAKE_INSTALL_PREFIX`` option to control searching
101   :variable:`CMAKE_INSTALL_PREFIX`.
102
103 * The :command:`find_file`, :command:`find_path`, :command:`find_library`,
104   :command:`find_program`, and :command:`find_package` commands gained the
105   ability to specify which Windows Registry views must be queried.
106
107 * The :command:`find_package` command gained a ``GLOBAL`` option that
108   allows for the promotion of imported targets to global scope for the
109   duration of the :command:`find_package` call.
110
111 * The :command:`if` command gained the capability to compare paths by
112   using the ``PATH_EQUAL`` operator.  See policy :policy:`CMP0139`.
113
114 Variables
115 ---------
116
117 * The :variable:`CMAKE_COLOR_DIAGNOSTICS` variable was added to control
118   color diagnostics generated by compilers.  This variable also controls
119   color build system messages with :ref:`Makefile Generators`, replacing
120   :variable:`CMAKE_COLOR_MAKEFILE`.
121
122   The :envvar:`CMAKE_COLOR_DIAGNOSTICS` environment variable was added to set
123   a default value for :variable:`CMAKE_COLOR_DIAGNOSTICS`.
124
125 * The :variable:`CMAKE_COMPILE_WARNING_AS_ERROR` variable and corresponding
126   :prop_tgt:`COMPILE_WARNING_AS_ERROR` target property were added to enable
127   compilation with a compiler-specific flag to treat warnings as errors,
128   such as ``-Werror``.
129
130 * The :variable:`CMAKE_CUDA_ARCHITECTURES` variable and associated
131   :prop_tgt:`CUDA_ARCHITECTURES` target property now support the
132   special ``native`` value to compile for the architectures(s)
133   of the host's GPU(s).
134
135 * The :variable:`CMAKE_FIND_PACKAGE_TARGETS_GLOBAL` variable was added to
136   toggle behavior of the :command:`find_package` command's new ``GLOBAL``
137   option.
138
139 * The :variable:`CMAKE_FIND_USE_INSTALL_PREFIX` variable was added to toggle
140   behavior of the :command:`find_file`, :command:`find_library`,
141   :command:`find_path`, :command:`find_package`, and :command:`find_program`
142   commands' new ``NO_CMAKE_INSTALL_PREFIX`` option.
143
144 * The :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variable was added to allow
145   injecting custom code at the site of the first :command:`project` call,
146   after the host and target platform details have been determined.
147
148 * The :variable:`CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES` variable
149   was added to tell the :command:`try_compile` command not to
150   pass any platform variables to the test project.
151
152 * The :variable:`CMAKE_VERIFY_INTERFACE_HEADER_SETS` variable and
153   corresponding :prop_tgt:`VERIFY_INTERFACE_HEADER_SETS` target property
154   were added to enable build rules that verify all headers in header sets
155   can be used on their own.
156
157 * The :variable:`CMAKE_VS_NO_COMPILE_BATCHING` variable and corresponding
158   :prop_tgt:`VS_NO_COMPILE_BATCHING` target property were added to
159   tell :ref:`Visual Studio Generators` whether to disable compiler
160   parallelism and call the compiler with one source file at a time.
161
162 * The :variable:`CMAKE_WATCOM_RUNTIME_LIBRARY` variable and
163   :prop_tgt:`WATCOM_RUNTIME_LIBRARY` target property were introduced to
164   select the runtime library used by compilers targeting the Watcom ABI.
165   See policy :policy:`CMP0136`.
166
167 * The :variable:`CMAKE_XCODE_XCCONFIG` variable and corresponding
168   :prop_tgt:`XCODE_XCCONFIG` target property were added to tell
169   the :generator:`Xcode` generator to handle ``xcconfig`` files.
170
171 Properties
172 ----------
173
174 * The :prop_tgt:`INTERFACE_LINK_LIBRARIES_DIRECT` and
175   :prop_tgt:`INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE` target properties
176   were added to express usage requirements affecting a consumer's
177   direct link dependencies.
178
179 * The :prop_tgt:`INTERFACE_HEADER_SETS_TO_VERIFY` target property was
180   added to specify which header sets should be verified by
181   :prop_tgt:`VERIFY_INTERFACE_HEADER_SETS`.
182
183 * The :prop_tgt:`LINK_LIBRARIES` target property now supports
184   the :genex:`$<LINK_ONLY:...>` generator expression.
185   See policy :policy:`CMP0131`.
186
187 * The :prop_tgt:`VS_DOTNET_STARTUP_OBJECT` target property was added to
188   tell :ref:`Visual Studio Generators` which startup class shall be used
189   when the program or project is executed. This is necessary when more
190   than one ``static void Main(string[])`` function signature is available
191   in a managed .NET project.
192
193 Modules
194 -------
195
196 * The :module:`ExternalProject` module :command:`ExternalProject_Add`
197   command gained a new ``DOWNLOAD_EXTRACT_TIMESTAMP`` option for
198   controlling whether the timestamps of extracted contents are set to
199   match those in the archive when the ``URL`` download method is used.
200   Policy :policy:`CMP0135` was added to enable the option by default.
201
202 * The :module:`FetchContent` module and the :command:`find_package` command
203   now support integration capabilities:
204
205   * :command:`FetchContent_MakeAvailable` can now try to satisfy a dependency
206     by calling :command:`find_package` first.  A new
207     :variable:`FETCHCONTENT_TRY_FIND_PACKAGE_MODE` variable controls whether
208     this is done by default for all dependencies, is opt-in per dependency,
209     or is disabled entirely.
210
211   * :command:`find_package` can be re-routed to call
212     :command:`FetchContent_MakeAvailable` instead.  A new read-only
213     :variable:`CMAKE_FIND_PACKAGE_REDIRECTS_DIR` variable points to a
214     directory where config package files can be located to facilitate these
215     re-routed calls.
216
217 * The :module:`FindJNI` module now provides imported targets.
218
219 * The :module:`FindMatlab` module :command:`matlab_add_mex` function
220   gained a ``NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES`` option to disable
221   automatic linking of MATLAB libraries.
222
223 * The :module:`FindVulkan` module now supports components to select which
224   VulkanSDK tool and libraries to find in addition to the Vulkan SDK headers
225   and library.
226
227 * The :module:`FindZLIB` gained a new ``ZLIB_USE_STATIC_LIBS`` variable to
228   search only for static libraries.
229
230 Generator Expressions
231 ---------------------
232
233 * The :genex:`LINK_LIBRARY` generator expression was added to manage how
234   libraries are specified during the link step.
235   The :variable:`CMAKE_<LANG>_LINK_LIBRARY_USING_<FEATURE>` and
236   :variable:`CMAKE_LINK_LIBRARY_USING_<FEATURE>` variables are used to define
237   features usable by the :genex:`LINK_LIBRARY` generator expression.
238   Moreover, the :prop_tgt:`LINK_LIBRARY_OVERRIDE` and
239   :prop_tgt:`LINK_LIBRARY_OVERRIDE_<LIBRARY>` target properties are
240   available to resolve incompatible features.
241
242   The :genex:`LINK_LIBRARY` generator expression can link frameworks in
243   various ways when targeting ``Apple`` platforms.
244   The following features were added:
245
246   * ``FRAMEWORK``
247   * ``NEEDED_FRAMEWORK``
248   * ``REEXPORT_FRAMEWORK``
249   * ``WEAK_FRAMEWORK``
250
251   The :genex:`LINK_LIBRARY` generator expression can link libraries in
252   various ways when targeting ``Apple`` platforms.
253   The following features were added:
254
255   * ``NEEDED_LIBRARY``
256   * ``REEXPORT_LIBRARY``
257   * ``WEAK_LIBRARY``
258
259   The :genex:`LINK_LIBRARY` generator expression gained the feature
260   ``WHOLE_ARCHIVE`` to force load of all members in a static library.
261   This feature is supported on the following target platforms:
262
263   * all ``Apple`` variants
264   * ``Linux``
265   * all ``BSD`` variants
266   * ``SunOS``
267   * ``Windows``
268   * ``CYGWIN``
269   * ``MSYS``
270
271 * The :genex:`LINK_GROUP` generator expression was added to manage the
272   grouping of libraries during the link step.  The
273   :variable:`CMAKE_<LANG>_LINK_GROUP_USING_<FEATURE>` and
274   :variable:`CMAKE_LINK_GROUP_USING_<FEATURE>` variables are used to define
275   features usable with the :genex:`LINK_GROUP` generator expression.
276   This release defines the ``RESCAN`` feature, which can be used to handle
277   circular references among static libraries when using toolchains for
278   Linux, BSD, SunOS and GNU toolchains for Windows.
279
280 * The :genex:`PATH` generator expression was added to manage paths.
281
282 * The :genex:`PATH_EQUAL` generator expression was added to manage path
283   comparisons.
284
285 * The :genex:`TARGET_BUNDLE_DIR_NAME` generator expression
286   was added to evaluate to the name of the bundle directory
287   for a given bundle target.
288
289 CTest
290 -----
291
292 * :manual:`ctest(1)` gained a ``--test-output-truncation`` option (and
293   corresponding :variable:`CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION` variable) to
294   specify the truncation mode once the maximum test output size has been
295   reached. Possible values are ``tail`` (default), ``middle`` or ``head``.
296
297 CPack
298 -----
299
300 * The :cpack_gen:`CPack WIX Generator` gained a new variable,
301   :variable:`CPACK_WIX_ARCHITECTURE`, to specify the installer architecture
302   in order to support computers running Windows for ARM.
303
304 * CPack now supports the :variable:`CPACK_THREADS` option for ``zstd``
305   compression when compiled with libarchive 3.6 or higher.  It is
306   supported by official CMake binaries available on `cmake.org`_.
307
308 Deprecated and Removed Features
309 ===============================
310
311 * The :module:`CPack` module no longer enables the SLA by default in the
312   :cpack_gen:`CPack DragNDrop Generator`.  See policy :policy:`CMP0133`
313   and the :variable:`CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE` variable.
314
315 * The deprecated :cpack_gen:`CPack PackageMaker Generator` has been removed.
316
317 * The :module:`FindGLUT` module no longer provides the undocumented
318   ``GLUT_LIBRARY`` and ``GLUT_INCLUDE_PATH`` result variables.
319
320 * The :module:`FindVulkan` module no longer silently ignores unknown
321   components requested by a ``find_package(Vulkan REQUIRED ...)`` call.
322   With the addition of support for components, requests for unknown
323   components now produce an error.
324
325 Other Changes
326 =============
327
328 * CMake no longer sets environment variables like :envvar:`CC`, :envvar:`CXX`,
329   etc. when enabling the corresponding language during the first CMake run in
330   a build directory.  See policy :policy:`CMP0132`.
331
332 * The :module:`CheckIPOSupported` module :command:`check_ipo_supported`
333   command now uses the caller's :variable:`CMAKE_<LANG>_FLAGS`
334   and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` values.
335   See policy :policy:`CMP0138`.
336
337 * The :generator:`MSYS Makefiles` and :generator:`MinGW Makefiles`
338   generators, when a compiler is not explicitly specified, now select
339   the first compiler (of any name) found in directories listed by the
340   ``PATH`` environment variable.
341
342 * The :command:`try_compile` command
343   :ref:`whole-project <Try Compiling Whole Projects>` signature
344   now propagates platform variables.  See policy :policy:`CMP0137`.
345
346 * The :command:`while` command now diagnoses errors during condition
347   evaluation.  See policy :policy:`CMP0130`.
348
349 * The precompiled macOS binaries provided on `cmake.org`_ no longer attach a
350   SLA to the ``.dmg`` packages.  This was removed because macOS 12 deprecated
351   the tools used to attach ``.dmg`` resources.
352
353 * A precompiled Windows ``arm64`` binary is now provided on `cmake.org`_.
354
355 .. _`cmake.org`: https://cmake.org/download/
356
357 Updates
358 =======
359
360 Changes made since CMake 3.24.0 include the following.
361
362 3.24.1, 3.24.2
363 --------------
364
365 * These versions made no changes to documented features or interfaces.
366   Some implementation updates were made to support ecosystem changes
367   and/or fix regressions.
368
369 3.24.3
370 ------
371
372 * The ``LLVMFlang`` Fortran compiler support added in 3.24.0 has been extended:
373
374   * It now supports mixed-language linking between Fortran and C or CXX.
375   * It now supports the GNU ABI (MinGW) on Windows, but not yet the MSVC ABI.
376
377 * Some implementation updates were made to support ecosystem changes
378   and/or fix regressions.