3.19.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. CMake 3.19 Release Notes
  2. ************************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.18 include the following.
  6. New Features
  7. ============
  8. Presets
  9. -------
  10. * :manual:`cmake(1)` and :manual:`cmake-gui(1)` now recognize
  11. ``CMakePresets.json`` and ``CMakeUserPresets.json`` files (see
  12. :manual:`cmake-presets(7)`).
  13. Generators
  14. ----------
  15. * The :generator:`Xcode` generator now uses the Xcode "new build system"
  16. when generating for Xcode 12.0 or higher.
  17. See the :variable:`CMAKE_XCODE_BUILD_SYSTEM` variable.
  18. One may use ``-T buildsystem=1`` to switch to the legacy build system.
  19. * The :generator:`Xcode` generator gained support for linking libraries and
  20. frameworks via the *Link Binaries With Libraries* build phase instead of
  21. always by embedding linker flags directly. This behavior is controlled by
  22. a new :prop_tgt:`XCODE_LINK_BUILD_PHASE_MODE` target property, which is
  23. initialized by a new :variable:`CMAKE_XCODE_LINK_BUILD_PHASE_MODE`
  24. variable.
  25. * The :ref:`Visual Studio Generators` for VS 2015 and above gained support
  26. for the Visual Studio Tools for Android. One may now set
  27. :variable:`CMAKE_SYSTEM_NAME` to ``Android`` to generate ``.vcxproj`` files
  28. for the Android tools.
  29. Languages
  30. ---------
  31. * CMake learned to support ``ISPC`` as a first-class language that can be
  32. enabled via the :command:`project` and :command:`enable_language` commands.
  33. ``ISPC`` is currently supported by the :ref:`Makefile Generators`
  34. and the :generator:`Ninja` generator on Linux, macOS, and Windows
  35. using the Intel ISPC compiler.
  36. * ``CUDA`` language support for Clang now includes:
  37. - separable compilation (:prop_tgt:`CUDA_SEPARABLE_COMPILATION`), and
  38. - finding scattered toolkit installations when cross-compiling.
  39. * ``CUDA`` language support now works on QNX.
  40. Platforms
  41. ---------
  42. * Apple Silicon is now supported (since CMake 3.19.2):
  43. * The :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` is selected using ``uname -m``.
  44. Since this may vary based on CMake's own architecture and that of
  45. the invoking process tree, the :variable:`CMAKE_APPLE_SILICON_PROCESSOR`
  46. variable or :envvar:`CMAKE_APPLE_SILICON_PROCESSOR` environment
  47. variable may be set to specify a host architecture explicitly.
  48. * If :variable:`CMAKE_OSX_ARCHITECTURES` is not set, CMake adds explicit
  49. flags to tell the compiler to build for the
  50. :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` so the toolchain does not
  51. have to guess based on the process tree's architecture.
  52. File-Based API
  53. --------------
  54. * The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has
  55. been updated to 2.2.
  56. * The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object
  57. gained a new ``languageStandard`` field in the ``compileGroups`` objects.
  58. Command-Line
  59. ------------
  60. * The :manual:`cmake(1)` command-line tool's ``--install`` mode gained a
  61. ``--default-directory-permissions`` option.
  62. * :manual:`cmake(1)` gained a ``-E create_hardlink`` command-line tool
  63. that can be used to create hardlinks between files.
  64. GUI
  65. ---
  66. * The :manual:`CMake GUI <cmake-gui(1)>` now has an environment variable
  67. editor.
  68. Commands
  69. --------
  70. * The :command:`add_test` command now (officially) supports whitespace and
  71. other special characters in the name for the test it creates.
  72. See policy :policy:`CMP0110`.
  73. * The :command:`cmake_language` command gained a ``DEFER`` mode to
  74. schedule command calls to occur at the end of processing a directory.
  75. * The :command:`configure_file` command gained a ``NO_SOURCE_PERMISSIONS``
  76. option to suppress copying the input file's permissions to the output file.
  77. * The :command:`execute_process` command gained a ``COMMAND_ERROR_IS_FATAL``
  78. option to specify a fatal error.
  79. * The :command:`file(ARCHIVE_CREATE)` command gained a ``COMPRESSION_LEVEL``
  80. option to specify the compression level.
  81. * The :command:`file(CHMOD)` and :command:`file(CHMOD_RECURSE)` subcommands
  82. were added to set permissions of files and directories.
  83. * The :command:`file(DOWNLOAD)` command ``<file>`` argument is now
  84. optional. If it is not specified, the file is not saved.
  85. * The :command:`file(GENERATE)` command gained a new ``TARGET`` keyword to
  86. support resolving target-dependent generator expressions.
  87. * The :command:`file` command gained a new ``REAL_PATH`` sub-command to
  88. compute a path with symlinks resolved.
  89. * The :command:`find_package` command learned to handle a version range.
  90. * The :command:`separate_arguments` command gained a new ``PROGRAM`` option.
  91. It allows the arguments to be treated as a program invocation and will
  92. resolve the executable to a full path if it can be found.
  93. * The ``DIRECTORY`` option of the :command:`set_property`,
  94. :command:`get_property`, and :command:`get_directory_property` commands
  95. now accepts references to binary directory paths, such as the value of
  96. :variable:`CMAKE_CURRENT_BINARY_DIR`.
  97. * The :command:`string` command gained a set of new ``JSON`` sub commands
  98. that provide JSON parsing capabilities.
  99. Variables
  100. ---------
  101. * The :variable:`CMAKE_CLANG_VFS_OVERLAY` variable was added to tell
  102. Clang to use a VFS overlay to support the Windows SDK when
  103. cross-compiling from hosts with case-sensitive filesystems.
  104. * The :variable:`CMAKE_MFC_FLAG` variable now supports generator expressions.
  105. * The :variable:`CMAKE_OPTIMIZE_DEPENDENCIES` variable was added to
  106. initialize the new :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property and
  107. avoid unnecessarily building dependencies for a static library.
  108. * The :variable:`CMAKE_PCH_INSTANTIATE_TEMPLATES` variable was added to
  109. initialize the new :prop_tgt:`PCH_INSTANTIATE_TEMPLATES` target property.
  110. * The :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM` variable
  111. was added to tell the :ref:`Visual Studio Generators` what maximum
  112. version of the Windows SDK to choose.
  113. Properties
  114. ----------
  115. * The :prop_tgt:`EXCLUDE_FROM_ALL` target property now supports
  116. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  117. * The :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property was added to
  118. avoid unnecessarily building dependencies for a static library.
  119. * The :prop_tgt:`PCH_INSTANTIATE_TEMPLATES` target property was added to enable
  120. template instantiation in the precompiled header. This is enabled by default
  121. and may significantly improve compile times. Currently only supported for
  122. Clang (version 11 or later).
  123. * The :prop_tgt:`WIN32_EXECUTABLE` target property now supports
  124. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  125. Modules
  126. -------
  127. * The :module:`CheckCompilerFlag` module has been added to
  128. generalize :module:`CheckCCompilerFlag` and
  129. :module:`CheckCXXCompilerFlag` to more languages.
  130. It also supports the ``CUDA`` and ``ISPC`` languages.
  131. * The :module:`CheckLinkerFlag` module now supports the ``CUDA`` language.
  132. * The :module:`CheckSourceCompiles` module has been added to
  133. generalize :module:`CheckCSourceCompiles` and
  134. :module:`CheckCXXSourceCompiles` to more languages.
  135. It also supports the ``CUDA`` and ``ISPC`` languages.
  136. * The :module:`CheckSourceRuns` module has been added to
  137. generalize :module:`CheckCSourceRuns` and
  138. :module:`CheckCXXSourceRuns` to more languages.
  139. It also supports the ``CUDA`` language.
  140. * The :module:`CMakePackageConfigHelpers` module gained support for version
  141. ranges.
  142. * The :module:`FindCUDAToolkit` module gained support for finding CUDA
  143. toolkits that do not contain ``nvcc``, as well as for finding scattered
  144. toolkit installations when cross-compiling.
  145. * The :module:`FindPackageHandleStandardArgs` module learned to handle
  146. version ranges. It also gained the ``find_package_check_version()`` command
  147. to check the validity of a version against version-related arguments of
  148. :command:`find_package` command.
  149. * The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  150. modules gained the ability to handle a version range.
  151. * The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  152. modules provide, respectively, the variable ``Python3_LINK_OPTIONS``,
  153. ``Python2_LINK_OPTIONS`` and ``Python_LINK_OPTIONS`` for link options.
  154. * The :module:`FindSDL` module now provides:
  155. * An imported target ``SDL::SDL``.
  156. * Result variables ``SDL_LIBRARIES`` and ``SDL_INCLUDE_DIRS``.
  157. * Version variables ``SDL_VERSION``, ``SDL_VERSION_MAJOR``,
  158. ``SDL_VERSION_MINOR``, and ``SDL_VERSION_PATCH``.
  159. * The :module:`FindSWIG` module gained the ability to handle a version range.
  160. * The :module:`FindTIFF` module gained a ``CXX`` component to
  161. find the ``tiffxx`` library containing C++ bindings.
  162. * The :module:`FindVulkan` module now provides a ``Vulkan::glslc`` imported
  163. target and associated ``Vulkan_GLSLC_EXECUTABLE`` variable which contain
  164. the path to the GLSL SPIR-V compiler.
  165. * The :module:`UseSWIG` module gained support for new source file properties
  166. ``OUTPUT_DIR`` and ``OUTFILE_DIR`` to manage output directories on a
  167. per-source basis.
  168. CTest
  169. -----
  170. * :manual:`ctest(1)` now supports the CUDA ``compute-sanitizer`` checker
  171. (previously known as ``cuda-memcheck``) as the ``CTEST_MEMORYCHECK_COMMAND``.
  172. The different tools (``memcheck``, ``racecheck``, ``synccheck`` and
  173. ``initcheck``) supported by ``compute-sanitizer`` can be selected by
  174. adding appropriate flags to the ``CTEST_MEMORYCHECK_COMMAND_OPTIONS``
  175. variable. The default flags are ``--tool memcheck --leak-check full``.
  176. CPack
  177. -----
  178. * CPack gained the :variable:`CPACK_PRE_BUILD_SCRIPTS`,
  179. :variable:`CPACK_POST_BUILD_SCRIPTS`, and :variable:`CPACK_PACKAGE_FILES`
  180. variables.
  181. * The :cpack_gen:`CPack External Generator` gained the
  182. :variable:`CPACK_EXTERNAL_BUILT_PACKAGES` variable.
  183. * The :cpack_gen:`CPack WIX Generator` gained a
  184. :variable:`CPACK_WIX_CUSTOM_XMLNS` option to specify custom XML namespaces.
  185. Other
  186. -----
  187. * :ref:`Interface Libraries` may now have source files added via
  188. :command:`add_library` or :command:`target_sources`. Those
  189. with sources will be generated as part of the build system.
  190. Deprecated and Removed Features
  191. ===============================
  192. * Compatibility with versions of CMake older than 2.8.12 is now deprecated
  193. and will be removed from a future version. Calls to
  194. :command:`cmake_minimum_required` or :command:`cmake_policy` that set
  195. the policy version to an older value now issue a deprecation diagnostic.
  196. * An explicit deprecation diagnostic was added for policy ``CMP0071``
  197. (``CMP0071`` and below were already deprecated).
  198. The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
  199. of all policies are deprecated and that projects should port to the
  200. NEW behaviors.
  201. * macOS SDKs older than 10.5 are no longer supported.
  202. * :manual:`cmake-gui(1)` now requires Qt5.
  203. Support for compiling with Qt4 has been removed.
  204. * The :manual:`cmake(1)` command-line option ``--warn-unused-vars`` has
  205. been removed and is now silently ignored. The option has not worked
  206. correctly since CMake 3.3.
  207. Documentation
  208. =============
  209. The following guides have been added:
  210. * :guide:`IDE Integration Guide`
  211. * :guide:`Importing and Exporting Guide`
  212. Other Changes
  213. =============
  214. * Building for macOS will now use the latest SDK available on the system,
  215. unless the user has explicitly chosen a SDK using
  216. :variable:`CMAKE_OSX_SYSROOT`. The deployment target or system macOS
  217. version will not affect the choice of SDK.
  218. * The :variable:`CMAKE_<LANG>_COMPILER` variable may now be used to
  219. store "mandatory" compiler flags like the :envvar:`CC` and other environment
  220. variables.
  221. * The :variable:`CMAKE_<LANG>_FLAGS_INIT` variable will now be considered
  222. during the compiler identification check if other sources like
  223. :variable:`CMAKE_<LANG>_FLAGS` or :envvar:`CFLAGS` are not set.
  224. * The :command:`find_program` command now requires permission to execute
  225. but not to read the file found. See policy :policy:`CMP0109`.
  226. * An imported target missing its location property fails during generation
  227. if the location is used. See policy :policy:`CMP0111`.
  228. * The following target-based generator expressions that query for directory or
  229. file name components no longer add a dependency on the evaluated target.
  230. See policy :policy:`CMP0112`.
  231. - ``TARGET_FILE_DIR``
  232. - ``TARGET_LINKER_FILE_BASE_NAME``
  233. - ``TARGET_LINKER_FILE_NAME``
  234. - ``TARGET_LINKER_FILE_DIR``
  235. - ``TARGET_SONAME_FILE_NAME``
  236. - ``TARGET_SONAME_FILE_DIR``
  237. - ``TARGET_PDB_FILE_NAME``
  238. - ``TARGET_PDB_FILE_DIR``
  239. - ``TARGET_BUNDLE_DIR``
  240. - ``TARGET_BUNDLE_CONTENT_DIR``
  241. * :ref:`Makefile Generators` no longer repeat custom commands from target
  242. dependencies. See policy :policy:`CMP0113`.
  243. * The :module:`ExternalProject` module handling of step target dependencies
  244. has been revised. See policy :policy:`CMP0114`.
  245. * The :prop_tgt:`OSX_ARCHITECTURES` target property is now respected
  246. for the ``ASM`` language.
  247. * If ``CUDA`` compiler detection fails with user-specified
  248. :variable:`CMAKE_CUDA_ARCHITECTURES` or
  249. :variable:`CMAKE_CUDA_HOST_COMPILER`, an error is raised.
  250. Updates
  251. =======
  252. Changes made since CMake 3.19.0 include the following.
  253. 3.19.1
  254. ------
  255. * CMake 3.19.0 compiles source files with the :prop_sf:`LANGUAGE`
  256. property by passing an explicit language flag such as ``-x c``.
  257. This is consistent with the property's documented meaning that
  258. the source file is written in the specified language. However,
  259. it can break projects that were using the property only to
  260. cause the specified language's compiler to be used. This has
  261. been reverted to restore behavior from CMake 3.18 and below.
  262. * CUDA 11.1 support for Clang.
  263. 3.19.2
  264. ------
  265. * The precompiled macOS binary provided on ``cmake.org`` is now a
  266. universal binary with ``x86_64`` and ``arm64`` architectures.
  267. It requires macOS 10.10 or newer.
  268. The package file naming pattern has been changed from
  269. ``cmake-$ver-Darwin-x86_64`` to ``cmake-$ver-macos-universal``.
  270. * Apple Silicon host architecture selection support was updated.
  271. CMake 3.19.0 and 3.19.1 always chose ``arm64`` as the host architecture.
  272. CMake 3.19.2 returns to using ``uname -m`` as CMake 3.18 and below did.
  273. Since this may vary based on CMake's own architecture and that of
  274. the invoking process tree, the :variable:`CMAKE_APPLE_SILICON_PROCESSOR`
  275. variable or :envvar:`CMAKE_APPLE_SILICON_PROCESSOR` environment
  276. variable may be set to specify a host architecture explicitly.
  277. * The :variable:`CMAKE_ISPC_HEADER_SUFFIX` variable and corresponding
  278. :prop_tgt:`ISPC_HEADER_SUFFIX` target property were added to control
  279. the header suffix used by ``ISPC`` compiler generated headers.
  280. 3.19.3
  281. ------
  282. * A precompiled Linux ``aarch64`` binary is now provided on ``cmake.org``.
  283. * Two precompiled macOS binaries are now provided on ``cmake.org``:
  284. * The naming pattern ``cmake-$ver-macos-universal`` is a universal
  285. binary with ``x86_64`` and ``arm64`` architectures. It requires
  286. macOS 10.13 or newer.
  287. * The naming pattern ``cmake-$ver-macos10.10-universal`` is a universal
  288. binary with ``x86_64`` and ``arm64`` architectures. It requires
  289. macOS 10.10 or newer.
  290. 3.19.4
  291. ------
  292. * The :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM`
  293. variable introduced in 3.19.0 previously worked only with the
  294. :generator:`Visual Studio 14 2015` generator. It has now been fixed to
  295. work with :ref:`Visual Studio Generators` for later VS versions too.
  296. 3.19.5
  297. ------
  298. * When :prop_tgt:`IOS_INSTALL_COMBINED` is enabled and the :generator:`Xcode`
  299. generator is used, it is now possible to initiate an install or package
  300. creation by running ``cmake --install`` or ``cpack`` from the command line.
  301. When using the Xcode new build system, these are the only supported methods
  302. due to a limitation of Xcode. Initiating these operations by building the
  303. ``install`` or ``package`` targets in Xcode is only supported when using
  304. the legacy build system.
  305. * The framework handling introduced in 3.19.0 as part of supporting Xcode's
  306. *Link Binaries With Libraries* build phase broke the ability to switch
  307. between device and simulator builds without reconfiguring. That capability
  308. has now been restored.
  309. 3.19.6
  310. ------
  311. * The :manual:`cmake-presets(7)` feature no longer allows comments in
  312. ``CMakePresets.json`` or ``CMakeUserPresets.json`` files.
  313. This was mistakenly allowed by the implementation in CMake 3.19.0 through
  314. CMake 3.19.5, and was not documented.
  315. 3.19.7
  316. ------
  317. * With :ref:`Visual Studio Generators` for VS 2017 and higher, the
  318. :variable:`CMAKE_GENERATOR_TOOLSET` field ``version=`` now accepts
  319. three-component MSVC toolset versions such as ``14.28.29910``.
  320. See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_VERSION` variable.