3.20.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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 partially supported.
  34. As of oneAPI 2021.1, ``ifx`` does not define several identification
  35. macros, so CMake identifies it as the classic ``Intel`` compiler.
  36. This works in many cases because ``ifx`` accepts the same command line
  37. parameters as ``ifort``. A future version of oneAPI may fix this.
  38. * The ``ifx`` Fortran compiler on Windows is not yet supported.
  39. The Intel oneAPI Classic compilers (``icc``, ``icpc``, and ``ifort``)
  40. continue to be supported with compiler id ``Intel``.
  41. * Support was added for the IAR STM8 compiler.
  42. Platforms
  43. ---------
  44. * CMake's support for :ref:`Cross Compiling for Android`
  45. is now merged with the Android NDK's toolchain file.
  46. They now have similar behavior, though some variable names differ.
  47. User-facing changes include:
  48. - ``find_*`` functions will search NDK ABI / API specific paths by default.
  49. - The default :variable:`CMAKE_BUILD_TYPE` for Android is
  50. now ``RelWithDebInfo``.
  51. - The :variable:`CMAKE_ANDROID_NDK_VERSION` variable was added to
  52. report the version of the NDK.
  53. File-Based API
  54. --------------
  55. * The :manual:`cmake-file-api(7)` gained a new "toolchains" object
  56. kind that describes the compiler used for each enabled language.
  57. Commands
  58. --------
  59. * :command:`add_custom_command` and :command:`add_custom_target` now
  60. support :manual:`generator expressions <cmake-generator-expressions(7)>`
  61. in their ``OUTPUT`` and ``BYPRODUCTS`` options.
  62. Their ``COMMAND``, ``WORKING_DIRECTORY``, and ``DEPENDS`` options gained
  63. support for new generator expressions ``$<COMMAND_CONFIG:...>`` and
  64. ``$<OUTPUT_CONFIG:...>`` that control cross-config handling when using
  65. the :generator:`Ninja Multi-Config` generator.
  66. * The :command:`add_custom_command` command gained ``DEPFILE`` support on
  67. :ref:`Makefile Generators`.
  68. * The :command:`add_library` command previously prohibited imported object
  69. libraries when using potentially multi-architecture configurations.
  70. This mostly affected the :generator:`Xcode` generator, e.g. when targeting
  71. iOS or one of the other device platforms. This restriction has now been
  72. removed.
  73. * The :command:`cmake_path` command was added for operations on
  74. filesystem paths.
  75. * The :command:`configure_file` command gained ``USE_SOURCE_PERMISSIONS``
  76. and ``FILE_PERMISSIONS`` options to support copying of permissions of the
  77. source file and using specified permissions respectively.
  78. * The :command:`file(GENERATE)` command gained a ``NEWLINE_STYLE`` option to
  79. specify how newlines are handled for the generated file.
  80. * The :command:`file(GENERATE)` command gained ``NO_SOURCE_PERMISSIONS``,
  81. ``USE_SOURCE_PERMISSIONS``, and ``FILE_PERMISSIONS`` options for controlling
  82. the permissions of the generated file.
  83. * The :command:`install(FILES)` command ``RENAME`` option learned to
  84. support :manual:`generator expressions <cmake-generator-expressions(7)>`.
  85. * The :command:`target_include_directories` command gained a new option
  86. ``AFTER``.
  87. * The :command:`target_sources` command now supports targets created
  88. by the :command:`add_custom_target` command.
  89. * The :command:`try_run` command gained a ``WORKING_DIRECTORY`` option to
  90. set the working directory in which to run the compiled check executable.
  91. Variables
  92. ---------
  93. * The :variable:`CMAKE_<LANG>_BYTE_ORDER` variable was added to provide the
  94. target architecture byte order detected from the toolchain.
  95. * The :variable:`CMAKE_RUNTIME_OUTPUT_DIRECTORY`,
  96. :variable:`CMAKE_LIBRARY_OUTPUT_DIRECTORY`, and
  97. :variable:`CMAKE_ARCHIVE_OUTPUT_DIRECTORY` variables now support
  98. target-dependent generator expressions.
  99. Properties
  100. ----------
  101. * The :prop_tgt:`<LANG>_CLANG_TIDY` target property and the associated
  102. :variable:`CMAKE_<LANG>_CLANG_TIDY` variable learned to support
  103. the ``OBJC`` and ``OBJCXX`` languages.
  104. * The :prop_tgt:`EXPORT_COMPILE_COMMANDS` target property was added
  105. for the associated :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable
  106. to allow for configuration of exporting compile commands per target.
  107. * The :prop_sf:`GENERATED` source-file property is now visible
  108. from any directory scope, regardless of the scope in which it is set.
  109. See policy :policy:`CMP0118`.
  110. * The :prop_tgt:`UNITY_BUILD_UNIQUE_ID` target property
  111. was added to support generation of an identifier that is
  112. unique per source file in unity builds. It can help to
  113. resolve duplicate symbol problems with anonymous namespaces.
  114. * The :prop_tgt:`WIN32_EXECUTABLE` target property now works with Clang
  115. on Windows.
  116. * The :prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` target property
  117. was added to tell the :generator:`Xcode` generator to embed frameworks.
  118. Aspects of the embedding can be customized with the
  119. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_PATH <XCODE_EMBED_<type>>`,
  120. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY`, and
  121. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY` target properties.
  122. Modules
  123. -------
  124. * The :module:`ExternalData` module :command:`ExternalData_Add_Target`
  125. function gained a ``SHOW_PROGRESS <bool>`` option for controlling whether
  126. or not to show progress output during the build.
  127. * The :module:`ExternalProject` module :command:`ExternalProject_Add` function
  128. gained a ``CONFIGURE_HANDLED_BY_BUILD`` option. This can be used to make
  129. subsequent runs of the configure step be triggered by the build step when
  130. an external project dependency rebuilds instead of always re-running the
  131. configure step in such cases.
  132. * The :module:`FindBoost` module gained a ``Boost_NO_WARN_NEW_VERSIONS``
  133. option to silence the warning about unknown dependencies for new
  134. Boost versions.
  135. * The :module:`FindCUDAToolkit` module gained support for finding CUDA
  136. toolkits when ``nvcc`` is a symbolic link,
  137. for example due to a ``ccache`` or ``colornvcc`` wrapper script.
  138. * The :module:`FindGDAL` module has been improved to document and mark as
  139. advanced its cache variables. There is a new ``FindGDAL_SKIP_GDAL_CONFIG``
  140. variable which may be used to skip over the ``gdal-config``-based search.
  141. Users may also set ``GDAL_ADDITIONAL_LIBRARY_VERSIONS`` to add additional
  142. versions to the library name search strategy.
  143. * The :module:`FindIntl` module now provides an imported target.
  144. * The :module:`FindOpenSSL` module learned to support a version range.
  145. * The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  146. modules gained options controlling how unversioned interpreter names are
  147. searched.
  148. * The :module:`UseJava` module ``add_jar()`` command's
  149. ``GENERATE_NATIVE_HEADERS`` feature gained options to export the
  150. generated target.
  151. * The :module:`UseSWIG` module gained the capability, for
  152. :ref:`Makefile <Makefile Generators>` and :ref:`Ninja <Ninja Generators>`
  153. generators, to use the ``swig`` tool to generate implicit dependencies.
  154. Autogen
  155. -------
  156. * The :ref:`Qt AUTOMOC` feature now works with per-config sources.
  157. CTest
  158. -----
  159. * :manual:`ctest(1)` gained a ``--test-dir`` option to specify the directory
  160. in which to look for tests.
  161. CPack
  162. -----
  163. * :module:`CPack` gained the :variable:`CPACK_THREADS` variable to
  164. control the number of threads used for parallelized operations,
  165. such as compressing the installer package.
  166. * The :cpack_gen:`CPack DEB Generator` learned a new
  167. :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS`
  168. variable to specify additional search directories for
  169. resolving private library dependencies when using
  170. ``dpkg-shlibdeps``.
  171. * The :cpack_gen:`CPack IFW Generator` gained a new
  172. :variable:`CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST` variable to
  173. control visibility of the widget listing installer pages on the left side
  174. of the wizard. This feature available only since QtIFW 4.0.
  175. * The :cpack_gen:`CPack NSIS Generator` gained new
  176. :variable:`CPACK_NSIS_BRANDING_TEXT` and
  177. :variable:`CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION` variables to change
  178. the text at the bottom of the install window and change its trim position
  179. * The :cpack_gen:`CPack NSIS Generator` now correctly handles Unicode
  180. characters. If you want to have a :variable:`CPACK_RESOURCE_FILE_LICENSE`
  181. with UTF-8 characters, it needs to be encoded in UTF-8 BOM.
  182. * The :cpack_gen:`CPack NuGet Generator` gained options:
  183. - :variable:`CPACK_NUGET_PACKAGE_ICON` and
  184. :variable:`CPACK_NUGET_<compName>_PACKAGE_ICON`
  185. allow package icons to be specified by local files.
  186. - :variable:`CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION` and
  187. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_EXPRESSION` add
  188. support for specifying licenses recognized by the
  189. `Software Package Data Exchange`_ (SPDX).
  190. - :variable:`CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME` and
  191. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_FILE_NAME` allow
  192. licenses to be specified by local files.
  193. - :variable:`CPACK_NUGET_PACKAGE_LANGUAGE` and
  194. :variable:`CPACK_NUGET_<compName>_PACKAGE_LANGUAGE` allow the locale
  195. for a package to be specified, for example ``en_CA``.
  196. .. _Software Package Data Exchange: https://spdx.org/
  197. Deprecated and Removed Features
  198. ===============================
  199. * The :manual:`cmake-server(7)` mode has been removed.
  200. Clients should use the :manual:`cmake-file-api(7)` instead.
  201. * The :module:`WriteCompilerDetectionHeader` module has been deprecated
  202. via policy :policy:`CMP0120`. Projects should be ported away from it.
  203. * The :module:`TestBigEndian` module has been deprecated in favor
  204. of the :variable:`CMAKE_<LANG>_BYTE_ORDER` variable.
  205. * The :module:`AddFileDependencies` module is deprecated.
  206. Port projects to use :command:`set_property` directly.
  207. * The :cpack_gen:`CPack NuGet Generator` deprecated some variables to reflect
  208. changes in the NuGet specification:
  209. - :variable:`CPACK_NUGET_PACKAGE_ICONURL` and
  210. :variable:`CPACK_NUGET_<compName>_PACKAGE_ICONURL` have been deprecated;
  211. replace with a reference to a local icon file.
  212. - :variable:`CPACK_NUGET_PACKAGE_LICENSEURL` and
  213. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSEURL` have been deprecated;
  214. replace with a reference to the project's license file or SPDX
  215. license expression.
  216. Other Changes
  217. =============
  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.