3.20.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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 ``$<COMMAND_CONFIG:...>`` and
  60. ``$<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. * The :prop_sf:`GENERATED` source-file property is now visible
  104. from any directory scope, regardless of the scope in which it is set.
  105. See policy :policy:`CMP0118`.
  106. * The :prop_tgt:`UNITY_BUILD_UNIQUE_ID` target property
  107. was added to support generation of an identifier that is
  108. unique per source file in unity builds. It can help to
  109. resolve duplicate symbol problems with anonymous namespaces.
  110. * The :prop_tgt:`WIN32_EXECUTABLE` target property now works with Clang
  111. on Windows.
  112. * The :prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` target property
  113. was added to tell the :generator:`Xcode` generator to embed frameworks.
  114. Aspects of the embedding can be customized with the
  115. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_PATH <XCODE_EMBED_<type>>`,
  116. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY`, and
  117. :prop_tgt:`XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY` target properties.
  118. Modules
  119. -------
  120. * The :module:`ExternalData` module :command:`ExternalData_Add_Target`
  121. function gained a ``SHOW_PROGRESS <bool>`` option for controlling whether
  122. or not to show progress output during the build.
  123. * The :module:`ExternalProject` module :command:`ExternalProject_Add` function
  124. gained a ``CONFIGURE_HANDLED_BY_BUILD`` option. This can be used to make
  125. subsequent runs of the configure step be triggered by the build step when
  126. an external project dependency rebuilds instead of always re-running the
  127. configure step in such cases.
  128. * The :module:`FindBoost` module gained a ``Boost_NO_WARN_NEW_VERSIONS``
  129. option to silence the warning about unknown dependencies for new
  130. Boost versions.
  131. * The :module:`FindCUDAToolkit` module gained support for finding CUDA
  132. toolkits when ``nvcc`` is a symbolic link,
  133. for example due to a ``ccache`` or ``colornvcc`` wrapper script.
  134. * The :module:`FindGDAL` module has been improved to document and mark as
  135. advanced its cache variables. There is a new ``FindGDAL_SKIP_GDAL_CONFIG``
  136. variable which may be used to skip over the ``gdal-config``-based search.
  137. Users may also set ``GDAL_ADDITIONAL_LIBRARY_VERSIONS`` to add additional
  138. versions to the library name search strategy.
  139. * The :module:`FindIntl` module now provides an imported target.
  140. * The :module:`FindOpenSSL` module learned to support a version range.
  141. * The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  142. modules gained options controlling how unversioned interpreter names are
  143. searched.
  144. * The :module:`UseJava` module ``add_jar()`` command's
  145. ``GENERATE_NATIVE_HEADERS`` feature gained options to export the
  146. generated target.
  147. * The :module:`UseSWIG` module gained the capability, for
  148. :ref:`Makefile <Makefile Generators>` and :ref:`Ninja <Ninja Generators>`
  149. generators, to use the ``swig`` tool to generate implicit dependencies.
  150. Autogen
  151. -------
  152. * The :ref:`Qt AUTOMOC` feature now works with per-config sources.
  153. CTest
  154. -----
  155. * :manual:`ctest(1)` gained a ``--test-dir`` option to specify the directory
  156. in which to look for tests.
  157. CPack
  158. -----
  159. * :module:`CPack` gained the :variable:`CPACK_THREADS` variable to
  160. control the number of threads used for parallelized operations,
  161. such as compressing the installer package.
  162. * The :cpack_gen:`CPack DEB Generator` learned a new
  163. :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS`
  164. variable to specify additional search directories for
  165. resolving private library dependencies when using
  166. ``dpkg-shlibdeps``.
  167. * The :cpack_gen:`CPack IFW Generator` gained a new
  168. :variable:`CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST` variable to
  169. control visibility of the widget listing installer pages on the left side
  170. of the wizard. This feature available only since QtIFW 4.0.
  171. * The :cpack_gen:`CPack NSIS Generator` gained new
  172. :variable:`CPACK_NSIS_BRANDING_TEXT` and
  173. :variable:`CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION` variables to change
  174. the text at the bottom of the install window and change its trim position
  175. * The :cpack_gen:`CPack NSIS Generator` now correctly handles Unicode
  176. characters. If you want to have a :variable:`CPACK_RESOURCE_FILE_LICENSE`
  177. with UTF-8 characters, it needs to be encoded in UTF-8 BOM.
  178. * The :cpack_gen:`CPack NuGet Generator` gained options:
  179. - :variable:`CPACK_NUGET_PACKAGE_ICON` and
  180. :variable:`CPACK_NUGET_<compName>_PACKAGE_ICON`
  181. allow package icons to be specified by local files.
  182. - :variable:`CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION` and
  183. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_EXPRESSION` add
  184. support for specifying licenses recognized by the
  185. `Software Package Data Exchange`_ (SPDX).
  186. - :variable:`CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME` and
  187. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_FILE_NAME` allow
  188. licenses to be specified by local files.
  189. - :variable:`CPACK_NUGET_PACKAGE_LANGUAGE` and
  190. :variable:`CPACK_NUGET_<compName>_PACKAGE_LANGUAGE` allow the locale
  191. for a package to be specified, for example ``en_CA``.
  192. .. _Software Package Data Exchange: https://spdx.org/
  193. Deprecated and Removed Features
  194. ===============================
  195. * The :manual:`cmake-server(7)` mode has been removed.
  196. Clients should use the :manual:`cmake-file-api(7)` instead.
  197. * The :module:`WriteCompilerDetectionHeader` module has been deprecated
  198. via policy :policy:`CMP0120`. Projects should be ported away from it.
  199. * The :module:`TestBigEndian` module has been deprecated in favor
  200. of the :variable:`CMAKE_<LANG>_BYTE_ORDER` variable.
  201. * The :module:`AddFileDependencies` module is deprecated.
  202. Port projects to use :command:`set_property` directly.
  203. * The :cpack_gen:`CPack NuGet Generator` deprecated some variables to reflect
  204. changes in the NuGet specification:
  205. - :variable:`CPACK_NUGET_PACKAGE_ICONURL` and
  206. :variable:`CPACK_NUGET_<compName>_PACKAGE_ICONURL` have been deprecated;
  207. replace with a reference to a local icon file.
  208. - :variable:`CPACK_NUGET_PACKAGE_LICENSEURL` and
  209. :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSEURL` have been deprecated;
  210. replace with a reference to the project's license file or SPDX
  211. license expression.
  212. Other Changes
  213. =============
  214. * When running :manual:`cmake(1)` to :ref:`Generate a Project Buildsystem`,
  215. unknown command-line arguments starting with a hyphen (``-``) are now
  216. rejected with an error. Previously they were silently ignored.
  217. * Source file extensions must now be explicit.
  218. See policy :policy:`CMP0115` for details.
  219. * The :prop_sf:`LANGUAGE` source file property now forces compilation
  220. as the specified language. See policy :policy:`CMP0119`.
  221. * On AIX, installation of XCOFF executables and shared libraries
  222. no longer requires relinking to change the runtime search path
  223. from the build-tree RPATH to the install-tree RPATH. CMake now
  224. edits the XCOFF binaries directly during installation, as has
  225. long been done on ELF platforms.
  226. * With MSVC-like compilers the value of
  227. :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` no longer contains
  228. the ``/GR`` flag for runtime type information by default.
  229. See policy :policy:`CMP0117`.
  230. * Ninja generators now transform the ``DEPFILE`` generated by an
  231. :command:`add_custom_command`. See policy :policy:`CMP0116` for details.
  232. * The precompiled Linux binaries provided on
  233. `cmake.org <https://cmake.org/download/>`_ have changed their naming pattern
  234. to ``cmake-$ver-linux-$arch``, where ``$arch`` is either ``x86_64`` or
  235. ``aarch64``.
  236. * The precompiled Windows binaries provided on
  237. `cmake.org <https://cmake.org/download/>`_ have changed their naming pattern
  238. to ``cmake-$ver-windows-$arch``, where ``$arch`` is either ``x86_64`` or
  239. ``i386``.
  240. Updates
  241. =======
  242. Changes made since CMake 3.20.0 include the following.
  243. 3.20.1
  244. ------
  245. * The :module:`FindIntl` module in CMake 3.20.0 added checks
  246. ``Intl_HAVE_GETTEXT_BUILTIN``, ``Intl_HAVE_DCGETTEXT_BUILTIN``,
  247. and ``Intl_IS_BUILTIN``, but they were not implemented correctly.
  248. These have been removed and replaced with a single ``Intl_IS_BUILT_IN``
  249. check, whose name is consistent with the :module:`FindIconv` module.
  250. * The ``-rpath`` linker flag is now specified as supported on all Apple
  251. platforms, not just macOS. The ``install_name_dir`` used for
  252. iOS, tvOS and watchOS should now default to ``@rpath`` instead of using
  253. a full absolute path and failing at runtime when the library or framework
  254. is embedded in an application bundle (see :prop_tgt:`XCODE_EMBED_<type>`).
  255. 3.20.2
  256. ------
  257. * The Intel Classic 2021 compiler version numbers are now detected correctly
  258. as having major version 2021. CMake 3.20.1 and below were not aware of a
  259. change to the identification macro version scheme made by Intel starting
  260. in version 2021, and detected the version as 20.2.
  261. * The Intel oneAPI Fortran compiler is now identified as ``IntelLLVM``.
  262. The oneAPI 2021.1 Fortran compiler is missing an identification macro,
  263. so CMake 3.20.1 and below identified it as ``Intel``. CMake now has
  264. a special case to recognize oneAPI 2021.1 Fortran as ``IntelLLVM``.
  265. The oneAPI 2021.2 Fortran compiler defines the proper identification
  266. macro and so is identified as ``IntelLLVM`` by all CMake 3.20 versions.
  267. 3.20.3, 3.20.4, 3.20.5, 3.20.6
  268. ------------------------------
  269. These versions made no changes to documented features or interfaces.
  270. Some implementation updates were made to support ecosystem changes
  271. and/or fix regressions.