3.19.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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. File-Based API
  41. --------------
  42. * The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has
  43. been updated to 2.2.
  44. * The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object
  45. gained a new ``languageStandard`` field in the ``compileGroups`` objects.
  46. Command-Line
  47. ------------
  48. * The :manual:`cmake(1)` command-line tool's ``--install`` mode gained a
  49. ``--default-directory-permissions`` option.
  50. * :manual:`cmake(1)` gained a ``-E create_hardlink`` command-line tool
  51. that can be used to create hardlinks between files.
  52. GUI
  53. ---
  54. * The :manual:`CMake GUI <cmake-gui(1)>` now has an environment variable
  55. editor.
  56. Commands
  57. --------
  58. * The :command:`add_test` command now (officially) supports whitespace and
  59. other special characters in the name for the test it creates.
  60. See policy :policy:`CMP0110`.
  61. * The :command:`cmake_language` command gained a ``DEFER`` mode to
  62. schedule command calls to occur at the end of processing a directory.
  63. * The :command:`configure_file` command gained a ``NO_SOURCE_PERMISSIONS``
  64. option to suppress copying the input file's permissions to the output file.
  65. * The :command:`execute_process` command gained a ``COMMAND_ERROR_IS_FATAL``
  66. option to specify a fatal error.
  67. * The :command:`file(ARCHIVE_CREATE)` command gained a ``COMPRESSION_LEVEL``
  68. option to specify the compression level.
  69. * The :command:`file(CHMOD)` and :command:`file(CHMOD_RECURSE)` subcommands
  70. were added to set permissions of files and directories.
  71. * The :command:`file(DOWNLOAD)` command ``<file>`` argument is now
  72. optional. If it is not specified, the file is not saved.
  73. * The :command:`file(GENERATE)` command gained a new ``TARGET`` keyword to
  74. support resolving target-dependent generator expressions.
  75. * The :command:`file` command gained a new ``REAL_PATH`` sub-command to
  76. compute a path with symlinks resolved.
  77. * The :command:`find_package` command learned to handle a version range.
  78. * The :command:`separate_arguments` command gained a new ``PROGRAM`` option.
  79. It allows the arguments to be treated as a program invocation and will
  80. resolve the executable to a full path if it can be found.
  81. * The ``DIRECTORY`` option of the :command:`set_property`,
  82. :command:`get_property`, and :command:`get_directory_property` commands
  83. now accepts references to binary directory paths, such as the value of
  84. :variable:`CMAKE_CURRENT_BINARY_DIR`.
  85. * The :command:`string` command gained a set of new ``JSON`` sub commands
  86. that provide JSON parsing capabilities.
  87. Variables
  88. ---------
  89. * The :variable:`CMAKE_CLANG_VFS_OVERLAY` variable was added to tell
  90. Clang to use a VFS overlay to support the Windows SDK when
  91. cross-compiling from hosts with case-sensitive filesystems.
  92. * The :variable:`CMAKE_MFC_FLAG` variable now supports generator expressions.
  93. * The :variable:`CMAKE_OPTIMIZE_DEPENDENCIES` variable was added to
  94. initialize the new :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property and
  95. avoid unnecessarily building dependencies for a static library.
  96. * The :variable:`CMAKE_PCH_INSTANTIATE_TEMPLATES` variable was added to
  97. initialize the new :prop_tgt:`PCH_INSTANTIATE_TEMPLATES` target property.
  98. * The :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM` variable
  99. was added to tell the :ref:`Visual Studio Generators` what maximum
  100. version of the Windows SDK to choose.
  101. Properties
  102. ----------
  103. * The :prop_tgt:`EXCLUDE_FROM_ALL` target property now supports
  104. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  105. * The :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property was added to
  106. avoid unnecessarily building dependencies for a static library.
  107. * The :prop_tgt:`PCH_INSTANTIATE_TEMPLATES` target property was added to enable
  108. template instantiation in the precompiled header. This is enabled by default
  109. and may significantly improve compile times. Currently only supported for
  110. Clang (version 11 or later).
  111. * The :prop_tgt:`WIN32_EXECUTABLE` target property now supports
  112. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  113. Modules
  114. -------
  115. * The :module:`CheckCompilerFlag` module has been added to
  116. generalize :module:`CheckCCompilerFlag` and
  117. :module:`CheckCXXCompilerFlag` to more languages.
  118. It also supports the ``CUDA`` and ``ISPC`` languages.
  119. * The :module:`CheckLinkerFlag` module now supports the ``CUDA`` language.
  120. * The :module:`CheckSourceCompiles` module has been added to
  121. generalize :module:`CheckCSourceCompiles` and
  122. :module:`CheckCXXSourceCompiles` to more languages.
  123. It also supports the ``CUDA`` and ``ISPC`` languages.
  124. * The :module:`CheckSourceRuns` module has been added to
  125. generalize :module:`CheckCSourceRuns` and
  126. :module:`CheckCXXSourceRuns` to more languages.
  127. It also supports the ``CUDA`` language.
  128. * The :module:`CMakePackageConfigHelpers` module gained support for version
  129. ranges.
  130. * The :module:`FindCUDAToolkit` module gained support for finding CUDA
  131. toolkits that do not contain ``nvcc``, as well as for finding scattered
  132. toolkit installations when cross-compiling.
  133. * The :module:`FindPackageHandleStandardArgs` module learned to handle
  134. version ranges. It also gained the ``find_package_check_version()`` command
  135. to check the validity of a version against version-related arguments of
  136. :command:`find_package` command.
  137. * The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  138. modules gained the ability to handle a version range.
  139. * The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  140. modules provide, respectively, the variable ``Python3_LINK_OPTIONS``,
  141. ``Python2_LINK_OPTIONS`` and ``Python_LINK_OPTIONS`` for link options.
  142. * The :module:`FindSDL` module now provides:
  143. * An imported target ``SDL::SDL``.
  144. * Result variables ``SDL_LIBRARIES`` and ``SDL_INCLUDE_DIRS``.
  145. * Version variables ``SDL_VERSION``, ``SDL_VERSION_MAJOR``,
  146. ``SDL_VERSION_MINOR``, and ``SDL_VERSION_PATCH``.
  147. * The :module:`FindSWIG` module gained the ability to handle a version range.
  148. * The :module:`FindTIFF` module gained a ``CXX`` component to
  149. find the ``tiffxx`` library containing C++ bindings.
  150. * The :module:`FindVulkan` module now provides a ``Vulkan::glslc`` imported
  151. target and associated ``Vulkan_GLSLC_EXECUTABLE`` variable which contain
  152. the path to the GLSL SPIR-V compiler.
  153. * The :module:`UseSWIG` module gained support for new source file properties
  154. ``OUTPUT_DIR`` and ``OUTFILE_DIR`` to manage output directories on a
  155. per-source basis.
  156. CTest
  157. -----
  158. * :manual:`ctest(1)` now supports the CUDA ``compute-sanitizer`` checker
  159. (previously known as ``cuda-memcheck``) as the ``CTEST_MEMORYCHECK_COMMAND``.
  160. The different tools (``memcheck``, ``racecheck``, ``synccheck`` and
  161. ``initcheck``) supported by ``compute-sanitizer`` can be selected by
  162. adding appropriate flags to the ``CTEST_MEMORYCHECK_COMMAND_OPTIONS``
  163. variable. The default flags are ``--tool memcheck --leak-check full``.
  164. CPack
  165. -----
  166. * CPack gained the :variable:`CPACK_PRE_BUILD_SCRIPTS`,
  167. :variable:`CPACK_POST_BUILD_SCRIPTS`, and :variable:`CPACK_PACKAGE_FILES`
  168. variables.
  169. * The :cpack_gen:`CPack External Generator` gained the
  170. :variable:`CPACK_EXTERNAL_BUILT_PACKAGES` variable.
  171. * The :cpack_gen:`CPack WIX Generator` gained a
  172. :variable:`CPACK_WIX_CUSTOM_XMLNS` option to specify custom XML namespaces.
  173. Other
  174. -----
  175. * :ref:`Interface Libraries` may now have source files added via
  176. :command:`add_library` or :command:`target_sources`. Those
  177. with sources will be generated as part of the build system.
  178. Deprecated and Removed Features
  179. ===============================
  180. * Compatibility with versions of CMake older than 2.8.12 is now deprecated
  181. and will be removed from a future version. Calls to
  182. :command:`cmake_minimum_required` or :command:`cmake_policy` that set
  183. the policy version to an older value now issue a deprecation diagnostic.
  184. * An explicit deprecation diagnostic was added for policy ``CMP0071``
  185. (``CMP0071`` and below were already deprecated).
  186. The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
  187. of all policies are deprecated and that projects should port to the
  188. NEW behaviors.
  189. * macOS SDKs older than 10.5 are no longer supported.
  190. * :manual:`cmake-gui(1)` now requires Qt5.
  191. Support for compiling with Qt4 has been removed.
  192. * The :manual:`cmake(1)` command-line option ``--warn-unused-vars`` has
  193. been removed and is now silently ignored. The option has not worked
  194. correctly since CMake 3.3.
  195. Documentation
  196. =============
  197. The following guides have been added:
  198. * :guide:`IDE Integration Guide`
  199. * :guide:`Importing and Exporting Guide`
  200. Other Changes
  201. =============
  202. * Building for macOS will now use the latest SDK available on the system,
  203. unless the user has explicitly chosen a SDK using
  204. :variable:`CMAKE_OSX_SYSROOT`. The deployment target or system macOS
  205. version will not affect the choice of SDK.
  206. * The :variable:`CMAKE_<LANG>_COMPILER` variable may now be used to
  207. store "mandatory" compiler flags like the :envvar:`CC` and other environment
  208. variables.
  209. * The :variable:`CMAKE_<LANG>_FLAGS_INIT` variable will now be considered
  210. during the compiler identification check if other sources like
  211. :variable:`CMAKE_<LANG>_FLAGS` or :envvar:`CFLAGS` are not set.
  212. * The :command:`find_program` command now requires permission to execute
  213. but not to read the file found. See policy :policy:`CMP0109`.
  214. * An imported target missing its location property fails during generation
  215. if the location is used. See policy :policy:`CMP0111`.
  216. * The following target-based generator expressions that query for directory or
  217. file name components no longer add a dependency on the evaluated target.
  218. See policy :policy:`CMP0112`.
  219. - ``TARGET_FILE_DIR``
  220. - ``TARGET_LINKER_FILE_BASE_NAME``
  221. - ``TARGET_LINKER_FILE_NAME``
  222. - ``TARGET_LINKER_FILE_DIR``
  223. - ``TARGET_SONAME_FILE_NAME``
  224. - ``TARGET_SONAME_FILE_DIR``
  225. - ``TARGET_PDB_FILE_NAME``
  226. - ``TARGET_PDB_FILE_DIR``
  227. - ``TARGET_BUNDLE_DIR``
  228. - ``TARGET_BUNDLE_CONTENT_DIR``
  229. * :ref:`Makefile Generators` no longer repeat custom commands from target
  230. dependencies. See policy :policy:`CMP0113`.
  231. * The :module:`ExternalProject` module handling of step target dependencies
  232. has been revised. See policy :policy:`CMP0114`.
  233. * The :prop_tgt:`OSX_ARCHITECTURES` target property is now respected
  234. for the ``ASM`` language.
  235. * If ``CUDA`` compiler detection fails with user-specified
  236. :variable:`CMAKE_CUDA_ARCHITECTURES` or
  237. :variable:`CMAKE_CUDA_HOST_COMPILER`, an error is raised.