1 CMake 3.21 Release Notes
2 ************************
8 Changes made since CMake 3.20 include the following.
16 * :manual:`cmake-presets(7)` gained support for specifying the install prefix
17 in a configure preset.
19 * :manual:`cmake-presets(7)` gained support for conditional enabling of presets.
21 * :manual:`cmake-presets(7)` gained support for a ``${hostSystemName}`` macro.
23 * :manual:`cmake-presets(7)` gained support for omitting the ``generator`` and
29 * The :generator:`Visual Studio 17 2022` generator was added.
31 * The :ref:`Makefile Generators` and the :generator:`Ninja` generator
32 learned to add linker launcher tools along with the linker for ``C``,
33 ``CXX``, ``OBJC``, and ``OBJCXX`` languages.
34 See the :variable:`CMAKE_<LANG>_LINKER_LAUNCHER` variable
35 and :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property for details.
40 * CMake learned to support ``HIP`` as a first-class language that can be
41 enabled via the :command:`project` and :command:`enable_language` commands.
43 * :prop_tgt:`C_STANDARD`, :prop_tgt:`OBJC_STANDARD`, and the
44 :manual:`Compile Features <cmake-compile-features(7)>` functionality gained
45 support for C17 and C23.
47 * Source file extensions ``.ixx`` and ``.cppm`` are now treated as C++.
52 * :manual:`cmake(1)` gained the ``--install-prefix <dir>``
53 command-line option to specify the location of the install prefix.
55 * :manual:`cmake(1)` gained the ``--toolchain <path/to/file>``
56 command-line option to specify a toolchain file.
58 * :manual:`cmake(1)` ``-E capabilities`` output, for some generators,
59 may now contain a ``supportedPlatforms`` field listing platforms
60 known to be supported in :variable:`CMAKE_GENERATOR_PLATFORM`.
62 * Messages printed to a terminal now may be colored by message type.
67 * The Fujitsu compiler is now supported using compiler id ``Fujitsu``
68 in traditional (``Trad``) mode, and compiler id ``FujitsuClang``
74 * CMake now supports the MSYS runtime environment, much like CYGWIN.
79 * The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field
80 has been updated to 2.3.
82 * The :manual:`cmake-file-api(7)` "codemodel" version 2 gained a
83 new "directory" object containing directory-level information.
84 This includes a list of installers generated by the :command:`install`
90 * The :command:`add_custom_command` command ``DEPFILE`` option:
93 :manual:`generator expressions <cmake-generator-expressions(7)>`,
95 * is now supported by :ref:`Visual Studio Generators` for VS 2012
98 * is now supported by the :generator:`Xcode` generator.
100 * The :command:`add_custom_command(TARGET)` command
101 (for :ref:`Build Events <add_custom_command(TARGET)>`)
102 gained support for resolving target-dependent generator expressions.
104 * The :command:`build_command` command gained a ``PARALLEL_LEVEL`` option.
106 * The :command:`file(COPY_FILE)` command was added to copy a single file.
108 * The :command:`file(GET_RUNTIME_DEPENDENCIES)` command gained new
109 ``POST_INCLUDE_FILES`` and ``POST_EXCLUDE_FILES`` arguments.
111 * The :command:`file(REAL_PATH)` command gained the option ``EXPAND_TILDE`` to
112 replace any leading tilde with the path to the user's home directory.
114 * The :command:`file(RENAME)` command learned to optionally capture
115 failure in a result variable. It also gained a ``NO_REPLACE``
116 option to fail if the destination exists.
118 * The :command:`install` command gained a new ``IMPORTED_RUNTIME_ARTIFACTS``
119 mode, which can be used to install the runtime artifacts of imported targets.
121 * The :command:`install` command gained a new ``RUNTIME_DEPENDENCY_SET`` mode,
122 which can be used to install runtime dependencies using
123 :command:`file(GET_RUNTIME_DEPENDENCIES)`.
125 * The :command:`install(TARGETS)` command gained new ``RUNTIME_DEPENDENCIES``
126 and ``RUNTIME_DEPENDENCY_SET`` arguments, which can be used to install
127 runtime dependencies using :command:`file(GET_RUNTIME_DEPENDENCIES)`.
129 * The :command:`install(SCRIPT|CODE)` command
130 supports a new option ``ALL_COMPONENTS`` which allows
131 the corresponding code to run for every component of
132 a per component installation.
134 * The :command:`project` command now sets variables
135 :variable:`PROJECT_IS_TOP_LEVEL` and :variable:`<PROJECT-NAME>_IS_TOP_LEVEL`
136 to indicate whether it was called in a top-level ``CMakeLists.txt`` file.
141 * The :envvar:`CMAKE_TOOLCHAIN_FILE` environment variable was added to
142 provide a default value for the :variable:`CMAKE_TOOLCHAIN_FILE` variable.
147 * The :prop_dir:`IMPORTED_TARGETS` directory property was added to
148 get a list of :ref:`Imported Targets` created in the current
151 * The :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS <XCODE_EMBED_<type>>` target property
152 was added to tell the :generator:`Xcode` generator to embed app extensions
153 such as iMessage sticker packs.
154 Aspects of the embedding can be customized with the
155 :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_PATH <XCODE_EMBED_<type>>`,
156 :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_CODE_SIGN_ON_COPY <XCODE_EMBED_<type>_CODE_SIGN_ON_COPY>` and
157 :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_REMOVE_HEADERS_ON_COPY <XCODE_EMBED_<type>_REMOVE_HEADERS_ON_COPY>`
163 * The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to support
164 the serial ``Fujitsu_SSL2`` and parallel ``Fujitsu_SSL2BLAMP`` libraries.
166 * The :module:`FindDevIL` module now provides imported targets.
168 * The :module:`FindIconv` module now has version support.
170 * The :module:`FindIntl` module now has version support.
172 * The :module:`FindMPI` module learned to support ``Fujitsu`` and
173 ``FujitsuClang`` in both host and cross compiling modes.
175 * The :module:`FindMsys` module was added to find MSYS installations.
176 Like :module:`FindCygwin`, it is used automatically by some other
177 find modules to locate UNIX-style tools on Windows.
179 * The :module:`FindOpenMP` module learned to support ``Fujitsu`` and
182 * The :module:`FindVulkan` module gained imported targets
183 ``Vulkan::Headers`` and ``Vulkan::glslangValidator``.
185 * The :module:`UseJava` module command ``add_jar`` gained a ``RESOURCES``
186 option to allow explicit naming of resources with non-optional namespace.
188 * The :module:`UseSWIG` module use now standard library naming conventions
189 for the ``CSharp`` language. See policy :policy:`CMP0122`.
191 * The :module:`UseSWIG` module now supports using the ``swig`` tool to
192 generate implicit dependencies with the :generator:`Xcode` generator.
194 Generator Expressions
195 ---------------------
197 * A new :genex:`TARGET_RUNTIME_DLLS` generator expression was added.
202 * :manual:`ctest(1)` gained documentation for its ability to capture
203 :ref:`Additional Test Measurements`.
205 * :manual:`ctest(1)` learned to recognize files attached to a test at run time.
206 Previously it was only possible to attach files to tests at configure time
207 by using the :prop_test:`ATTACHED_FILES` or
208 :prop_test:`ATTACHED_FILES_ON_FAIL` test properties.
209 See :ref:`Additional Test Measurements` for more information.
211 * :manual:`ctest(1)` gained a ``--output-junit`` option to write test results
214 * The :command:`ctest_build` command gained a ``PARALLEL_LEVEL`` option.
219 * The :cpack_gen:`CPack DragNDrop Generator` gained option
220 :variable:`CPACK_DMG_FILESYSTEM` to control the ``.dmg`` filesystem.
222 * The :cpack_gen:`CPack IFW Generator` now supports hyphens in names
223 given to :command:`cpack_ifw_configure_component` or
224 :command:`cpack_ifw_configure_component_group` as ``DEPENDS`` or
225 ``DEPENDENCIES`` arguments. This requires QtIFW 3.1 or later.
227 * The :cpack_gen:`CPack NSIS Generator` gained a new
228 :variable:`CPACK_NSIS_EXECUTABLE` variable to specify the ``makensis``
229 executable to use instead of the default one.
231 * The :variable:`CPACK_CUSTOM_INSTALL_VARIABLES` variable was added to set
232 variables in ``cmake_install.cmake`` script invocations made by CPack.
234 Deprecated and Removed Features
235 ===============================
237 * Undocumented :variable:`CMAKE_SYSTEM_NAME` version-stripping behavior has
238 been removed entirely. If it is set by a ``-D`` flag or by a
239 :manual:`toolchain file <cmake-toolchains(7)>`, it is left unaltered,
240 even if it still contains a version number.
241 Similar :variable:`CMAKE_HOST_SYSTEM_NAME` version-stripping behavior,
242 also undocumented, has been moved earlier, before :command:`project` or
243 :command:`enable_language` is called.
245 * ``ARMClang`` cpu/arch compile and link flags are no longer added
246 automatically based on the :variable:`CMAKE_SYSTEM_PROCESSOR`
247 variable or the undocumented ``CMAKE_SYSTEM_ARCH`` variable.
248 They must be specified explicitly. See policy :policy:`CMP0123`.
253 * The :command:`find_file`, :command:`find_path`, :command:`find_program`,
254 and :command:`find_library` commands handle cache variables in the same way
255 regardless how they are defined. See policy :policy:`CMP0125` for details.
257 * The :command:`find_file`, :command:`find_path`, :command:`find_program`,
258 and :command:`find_library` commands gained the option ``NO_CACHE`` to store
259 find result in normal variable.
261 * The :command:`foreach` command now isolates loop variables in the loop scope.
262 See policy :policy:`CMP0124` for details.
264 * The :command:`list` command's ``GET``, ``INSERT``, ``SUBLIST``, and
265 ``REMOVE_AT`` subcommands now error with invalid (i.e., non-integer) values
266 are given as any of their index arguments based on the setting of policy
269 * The :command:`set(CACHE)` command no longer removes a normal variable
270 of the same name, if any. See policy :policy:`CMP0126`.
272 * :command:`target_link_libraries` calls referencing object libraries
273 via the :genex:`TARGET_OBJECTS` generator expression now place the
274 object files before all libraries on the link line, regardless of
275 their specified order. See documentation on
276 :ref:`Linking Object Libraries via \$\<TARGET_OBJECTS\>` for details.
278 * The :ref:`Ninja Generators` now pass source files and include directories
279 to the compiler using absolute paths. This makes diagnostic messages and
280 debug symbols more consistent, and matches the :ref:`Makefile Generators`.
282 * The :generator:`NMake Makefiles` generator now encodes the generated
283 makefiles as UTF-8 with a BOM when using ``nmake`` from VS 9 or above.
285 * The :ref:`Visual Studio Generators` for VS 2010 and above now place
286 per-source preprocessor definitions after target-wide preprocssor
287 definitions. This makes VS consistent with the :ref:`Ninja Generators`
288 and the :ref:`Makefile Generators`.
290 * The precompiled binaries provided on
291 `cmake.org <https://cmake.org/download/>`_ now support
292 ``liblzma`` multi-threading. See the :variable:`CPACK_THREADS` and
293 :variable:`CPACK_ARCHIVE_THREADS` variables.
298 Changes made since CMake 3.21.0 include the following.
303 * The :generator:`Visual Studio 17 2022` generator is now based on
304 "Visual Studio 2022 Preview 2". Previously it was based on "Preview 1.1".
309 * ``CUDA`` targets with :prop_tgt:`CUDA_SEPARABLE_COMPILATION` enabled are now
310 correctly generated in non-root directories.
312 * The :generator:`Visual Studio 17 2022` generator is now based on
313 "Visual Studio 2022 Preview 3.1". Previously it was based on "Preview 2".
318 * The :generator:`Visual Studio 17 2022` generator is now based on
319 "Visual Studio 2022 Preview 4". Previously it was based on "Preview 3.1".
321 * The AMD ROCm Platform ``hipcc`` compiler was identifed by CMake 3.21.0
322 through 3.21.2 as a distinct compiler with id ``ROCMClang``. This has
323 been removed because it caused regressions. Instead:
325 * ``hipcc`` may no longer be used as a ``HIP`` compiler because it
326 interferes with flags CMake needs to pass to Clang. Use Clang directly.
328 * ``hipcc`` may once again be used as a ``CXX`` compiler, and is treated as
329 whatever compiler it selects underneath, as CMake 3.20 and below did.
334 * The :generator:`Visual Studio 17 2022` generator is now based on the
335 "Visual Studio 2022" release candidates. Previously it was based on
341 These versions made no changes to documented features or interfaces.
342 Some implementation updates were made to support ecosystem changes
343 and/or fix regressions.