3.19.rst 12 KB

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