3.20.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. CMake 3.20 Release Notes
  2. ************************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.19 include the following.
  6. New Features
  7. ============
  8. Presets
  9. -------
  10. * :manual:`cmake-presets(7)` gained support for build and test presets.
  11. Generators
  12. ----------
  13. * :ref:`Makefile Generators`, for some toolchains, now use the compiler
  14. to extract implicit dependencies while compiling source files.
  15. Languages
  16. ---------
  17. * C++23 compiler modes may now be specified via the :prop_tgt:`CXX_STANDARD`,
  18. :prop_tgt:`CUDA_STANDARD`, or :prop_tgt:`OBJCXX_STANDARD` target properties,
  19. or via the :manual:`Compile Features <cmake-compile-features(7)>`
  20. functionality's ``cxx_std_23`` meta-feature.
  21. * ``CUDA`` language support now works when ``nvcc`` is a symbolic link,
  22. for example due to a ``ccache`` or ``colornvcc`` wrapper script.
  23. * The :envvar:`CUDAARCHS` environment variable was added for initializing
  24. :variable:`CMAKE_CUDA_ARCHITECTURES`. Useful in cases where the compiler
  25. default is unsuitable for the machine's GPU.
  26. Compilers
  27. ---------
  28. * The NVIDIA HPC SDK compilers are now supported with compiler id ``NVHPC``.
  29. * The Intel oneAPI NextGen LLVM compilers are now supported with
  30. compiler id ``IntelLLVM``:
  31. * The ``icx``/``icpx`` C/C++ compilers on Linux, and the ``icx``
  32. C/C++ compiler on Windows, are fully supported as of oneAPI 2021.1.
  33. * The ``ifx`` Fortran compiler on Linux is supported as of oneAPI 2021.1.
  34. * The ``ifx`` Fortran compiler on Windows is not yet supported.
  35. The Intel oneAPI Classic compilers (``icc``, ``icpc``, and ``ifort``)
  36. continue to be supported with compiler id ``Intel``.
  37. * Support was added for the IAR STM8 compiler.
  38. Platforms
  39. ---------
  40. * CMake's support for :ref:`Cross Compiling for Android`
  41. is now merged with the Android NDK's toolchain file.
  42. They now have similar behavior, though some variable names differ.
  43. User-facing changes include:
  44. - ``find_*`` functions will search NDK ABI / API specific paths by default.
  45. - The default :variable:`CMAKE_BUILD_TYPE` for Android is
  46. now ``RelWithDebInfo``.
  47. - The :variable:`CMAKE_ANDROID_NDK_VERSION` variable was added to
  48. report the version of the NDK.
  49. File-Based API
  50. --------------
  51. * The :manual:`cmake-file-api(7)` gained a new "toolchains" object
  52. kind that describes the compiler used for each enabled language.
  53. Commands
  54. --------
  55. * :command:`add_custom_command` and :command:`add_custom_target` now
  56. support :manual:`generator expressions <cmake-generator-expressions(7)>`
  57. in their ``OUTPUT`` and ``BYPRODUCTS`` options.
  58. Their ``COMMAND``, ``WORKING_DIRECTORY``, and ``DEPENDS`` options gained
  59. support for new generator expressions :genex:`$<COMMAND_CONFIG:...>` and
  60. :genex:`$<OUTPUT_CONFIG:...>` that control cross-config handling when using
  61. the :generator:`Ninja Multi-Config` generator.
  62. * The :command:`add_custom_command` command gained ``DEPFILE`` support on
  63. :ref:`Makefile Generators`.
  64. * The :command:`add_library` command previously prohibited imported object
  65. libraries when using potentially multi-architecture configurations.
  66. This mostly affected the :generator:`Xcode` generator, e.g. when targeting
  67. iOS or one of the other device platforms. This restriction has now been
  68. removed.
  69. * The :command:`cmake_path` command was added for operations on
  70. filesystem paths.
  71. * The :command:`configure_file` command gained ``USE_SOURCE_PERMISSIONS``
  72. and ``FILE_PERMISSIONS`` options to support copying of permissions of the
  73. source file and using specified permissions respectively.
  74. * The :command:`file(GENERATE)` command gained a ``NEWLINE_STYLE`` option to
  75. specify how newlines are handled for the generated file.
  76. * The :command:`file(GENERATE)` command gained ``NO_SOURCE_PERMISSIONS``,
  77. ``USE_SOURCE_PERMISSIONS``, and ``FILE_PERMISSIONS`` options for controlling
  78. the permissions of the generated file.
  79. * The :command:`install(FILES)` command ``RENAME`` option learned to
  80. support :manual:`generator expressions <cmake-generator-expressions(7)>`.
  81. * The :command:`target_include_directories` command gained a new option
  82. ``AFTER``.
  83. * The :command:`target_sources` command now supports targets created
  84. by the :command:`add_custom_target` command.
  85. * The :command:`try_run` command gained a ``WORKING_DIRECTORY`` option to
  86. set the working directory in which to run the compiled check executable.
  87. Variables
  88. ---------
  89. * The :variable:`CMAKE_<LANG>_BYTE_ORDER` variable was added to provide the
  90. target architecture byte order detected from the toolchain.
  91. * The :variable:`CMAKE_RUNTIME_OUTPUT_DIRECTORY`,
  92. :variable:`CMAKE_LIBRARY_OUTPUT_DIRECTORY`, and
  93. :variable:`CMAKE_ARCHIVE_OUTPUT_DIRECTORY` variables now support
  94. target-dependent generator expressions.
  95. Properties
  96. ----------
  97. * The :prop_tgt:`<LANG>_CLANG_TIDY` target property and the associated
  98. :variable:`CMAKE_<LANG>_CLANG_TIDY` variable learned to support
  99. the ``OBJC`` and ``OBJCXX`` languages.
  100. * The :prop_tgt:`EXPORT_COMPILE_COMMANDS` target property was added
  101. for the associated :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable
  102. to allow for configuration of exporting compile commands per target.
  103. * Generated sources may be used across directories without manual marking.
  104. Additionally, the :prop_sf:`GENERATED` source file property can no longer be
  105. turned off once turned on, nor can it be set to other than boolean values.
  106. See policy :policy:`CMP0118`.
  107. * The :prop_tgt:`UNITY_BUILD_UNIQUE_ID` target property
  108. was added to support generation of an identifier that is
  109. unique per source file in unity builds. It can help to
  110. resolve duplicate symbol problems with anonymous namespaces.
  111. * The :prop_tgt:`WIN32_EXECUTABLE` target property now works with Clang
  112. on Windows.
  113. * The :prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` target property
  114. was added to tell the :generator:`Xcode` generator to embed frameworks.
  115. Aspects of the embedding can be customized with the
  116. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_PATH <XCODE_EMBED_<type>>`,
  117. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY`, and
  118. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY` target properties.
  119. Modules
  120. -------
  121. * The :module:`ExternalData` module :command:`ExternalData_Add_Target`
  122. function gained a ``SHOW_PROGRESS <bool>`` option for controlling whether
  123. or not to show progress output during the build.
  124. * The :module:`ExternalProject` module :command:`ExternalProject_Add` function
  125. gained a ``CONFIGURE_HANDLED_BY_BUILD`` option. This can be used to make
  126. subsequent runs of the configure step be triggered by the build step when
  127. an external project dependency rebuilds instead of always re-running the
  128. configure step in such cases.
  129. * The :module:`FindBoost` module gained a ``Boost_NO_WARN_NEW_VERSIONS``
  130. option to silence the warning about unknown dependencies for new
  131. Boost versions.
  132. * The :module:`FindCUDAToolkit` module gained support for finding CUDA
  133. toolkits when ``nvcc`` is a symbolic link,
  134. for example due to a ``ccache`` or ``colornvcc`` wrapper script.
  135. * The :module:`FindGDAL` module has been improved to document and mark as
  136. advanced its cache variables. There is a new ``FindGDAL_SKIP_GDAL_CONFIG``
  137. variable which may be used to skip over the ``gdal-config``-based search.
  138. Users may also set ``GDAL_ADDITIONAL_LIBRARY_VERSIONS`` to add additional
  139. versions to the library name search strategy.
  140. * The :module:`FindIntl` module now provides an imported target.
  141. * The :module:`FindOpenSSL` module learned to support a version range.
  142. * The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  143. modules gained options controlling how unversioned interpreter names are
  144. searched.
  145. * The :module:`UseJava` module ``add_jar()`` command's
  146. ``GENERATE_NATIVE_HEADERS`` feature gained options to export the
  147. generated target.
  148. * The :module:`UseSWIG` module gained the capability, for
  149. :ref:`Makefile <Makefile Generators>` and :ref:`Ninja <Ninja Generators>`
  150. generators, to use the ``swig`` tool to generate implicit dependencies.
  151. Autogen
  152. -------
  153. * The :ref:`Qt AUTOMOC` feature now works with per-config sources.
  154. CTest
  155. -----
  156. * :manual:`ctest(1)` gained a :option:`--test-dir <ctest --test-dir>`
  157. option to specify the directory in which to look for tests.
  158. CPack
  159. -----
  160. * :module:`CPack` gained the :variable:`CPACK_THREADS` variable to
  161. control the number of threads used for parallelized operations,
  162. such as compressing the installer package.
  163. * The :cpack_gen:`CPack DEB Generator` learned a new
  164. :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS`
  165. variable to specify additional search directories for
  166. resolving private library dependencies when using
  167. ``dpkg-shlibdeps``.
  168. * The :cpack_gen:`CPack IFW Generator` gained a new
  169. :variable:`CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST` variable to
  170. control visibility of the widget listing installer pages on the left side
  171. of the wizard. This feature available only since QtIFW 4.0.
  172. * The :cpack_gen:`CPack NSIS Generator` gained new
  173. :variable:`CPACK_NSIS_BRANDING_TEXT` and
  174. :variable:`CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION` variables to change
  175. the text at the bottom of the install window and change its trim position
  176. * The :cpack_gen:`CPack NSIS Generator` now correctly handles Unicode
  177. characters. If you want to have a :variable:`CPACK_RESOURCE_FILE_LICENSE`
  178. with UTF-8 characters, it needs to be encoded in UTF-8 BOM.
  179. * The :cpack_gen:`CPack NuGet Generator` gained options:
  180. - :variable:`CPACK_NUGET_PACKAGE_ICON` and
  181. :variable:`CPACK_NUGET_<compName>_PACKAGE_ICON`
  182. allow package icons to be specified by local files.
  183. - :variable:`CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION` and
  184. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_EXPRESSION` add
  185. support for specifying licenses recognized by the
  186. `Software Package Data Exchange`_ (SPDX).
  187. - :variable:`CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME` and
  188. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_FILE_NAME` allow
  189. licenses to be specified by local files.
  190. - :variable:`CPACK_NUGET_PACKAGE_LANGUAGE` and
  191. :variable:`CPACK_NUGET_<compName>_PACKAGE_LANGUAGE` allow the locale
  192. for a package to be specified, for example ``en_CA``.
  193. .. _Software Package Data Exchange: https://spdx.dev/
  194. Deprecated and Removed Features
  195. ===============================
  196. * The :manual:`cmake-server(7)` mode has been removed.
  197. Clients should use the :manual:`cmake-file-api(7)` instead.
  198. * The :module:`WriteCompilerDetectionHeader` module has been deprecated
  199. via policy :policy:`CMP0120`. Projects should be ported away from it.
  200. * The :module:`TestBigEndian` module has been deprecated in favor
  201. of the :variable:`CMAKE_<LANG>_BYTE_ORDER` variable.
  202. * The :module:`AddFileDependencies` module is deprecated.
  203. Port projects to use :command:`set_property` directly.
  204. * The :cpack_gen:`CPack NuGet Generator` deprecated some variables to reflect
  205. changes in the NuGet specification:
  206. - :variable:`CPACK_NUGET_PACKAGE_ICONURL` and
  207. :variable:`CPACK_NUGET_<compName>_PACKAGE_ICONURL` have been deprecated;
  208. replace with a reference to a local icon file.
  209. - :variable:`CPACK_NUGET_PACKAGE_LICENSEURL` and
  210. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSEURL` have been deprecated;
  211. replace with a reference to the project's license file or SPDX
  212. license expression.
  213. Other Changes
  214. =============
  215. * When running :manual:`cmake(1)` to :ref:`Generate a Project Buildsystem`,
  216. unknown command-line arguments starting with a hyphen (``-``) are now
  217. rejected with an error. Previously they were silently ignored.
  218. * Source file extensions must now be explicit.
  219. See policy :policy:`CMP0115` for details.
  220. * The :prop_sf:`LANGUAGE` source file property now forces compilation
  221. as the specified language. See policy :policy:`CMP0119`.
  222. * On AIX, installation of XCOFF executables and shared libraries
  223. no longer requires relinking to change the runtime search path
  224. from the build-tree RPATH to the install-tree RPATH. CMake now
  225. edits the XCOFF binaries directly during installation, as has
  226. long been done on ELF platforms.
  227. * With MSVC-like compilers the value of
  228. :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` no longer contains
  229. the ``/GR`` flag for runtime type information by default.
  230. See policy :policy:`CMP0117`.
  231. * Ninja generators now transform the ``DEPFILE`` generated by an
  232. :command:`add_custom_command`. See policy :policy:`CMP0116` for details.
  233. * The precompiled Linux binaries provided on
  234. `cmake.org <https://cmake.org/download/>`_ have changed their naming pattern
  235. to ``cmake-$ver-linux-$arch``, where ``$arch`` is either ``x86_64`` or
  236. ``aarch64``.
  237. * The precompiled Windows binaries provided on
  238. `cmake.org <https://cmake.org/download/>`_ have changed their naming pattern
  239. to ``cmake-$ver-windows-$arch``, where ``$arch`` is either ``x86_64`` or
  240. ``i386``.
  241. Updates
  242. =======
  243. Changes made since CMake 3.20.0 include the following.
  244. 3.20.1
  245. ------
  246. * The :module:`FindIntl` module in CMake 3.20.0 added checks
  247. ``Intl_HAVE_GETTEXT_BUILTIN``, ``Intl_HAVE_DCGETTEXT_BUILTIN``,
  248. and ``Intl_IS_BUILTIN``, but they were not implemented correctly.
  249. These have been removed and replaced with a single ``Intl_IS_BUILT_IN``
  250. check, whose name is consistent with the :module:`FindIconv` module.
  251. * The ``-rpath`` linker flag is now specified as supported on all Apple
  252. platforms, not just macOS. The ``install_name_dir`` used for
  253. iOS, tvOS and watchOS should now default to ``@rpath`` instead of using
  254. a full absolute path and failing at runtime when the library or framework
  255. is embedded in an application bundle (see :prop_tgt:`XCODE_EMBED_<type>`).
  256. 3.20.2
  257. ------
  258. * The Intel Classic 2021 compiler version numbers are now detected correctly
  259. as having major version 2021. CMake 3.20.1 and below were not aware of a
  260. change to the identification macro version scheme made by Intel starting
  261. in version 2021, and detected the version as 20.2.
  262. * The Intel oneAPI Fortran compiler is now identified as ``IntelLLVM``.
  263. The oneAPI 2021.1 Fortran compiler is missing an identification macro,
  264. so CMake 3.20.1 and below identified it as ``Intel``. CMake now has
  265. a special case to recognize oneAPI 2021.1 Fortran as ``IntelLLVM``.
  266. The oneAPI 2021.2 Fortran compiler defines the proper identification
  267. macro and so is identified as ``IntelLLVM`` by all CMake 3.20 versions.
  268. 3.20.3, 3.20.4, 3.20.5, 3.20.6
  269. ------------------------------
  270. These versions made no changes to documented features or interfaces.
  271. Some implementation updates were made to support ecosystem changes
  272. and/or fix regressions.