3.31.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. CMake 3.31 Release Notes
  2. ************************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.30 include the following.
  6. New Features
  7. ============
  8. Presets
  9. -------
  10. * :manual:`cmake-presets(7)` files may now include comments using the key
  11. ``$comment`` at any level within the JSON object to provide documentation.
  12. * :manual:`cmake-presets(7)` files may now request graphviz output using
  13. the ``graphviz`` key in a configure preset.
  14. Generators
  15. ----------
  16. * The :ref:`Ninja Generators` and :ref:`Makefile Generators` now produce
  17. a ``codegen`` build target. See policy :policy:`CMP0171`. It drives a
  18. subset of the build graph sufficient to run custom commands created with
  19. :command:`add_custom_command`'s new ``CODEGEN`` option.
  20. Command-Line
  21. ------------
  22. * The :option:`cmake --workflow` mode now accepts a preset name as the first
  23. argument, allowing the simpler command line
  24. :option:`cmake --workflow \<preset\> <cmake--workflow --preset>`.
  25. * The :option:`cmake -LR[A][H]` option was added to list cache entries
  26. whose names match a regular expression.
  27. Compilers
  28. ---------
  29. * The LFortran compiler is now supported with
  30. :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` ``LFortran``.
  31. Commands
  32. --------
  33. * The :command:`add_custom_command` command gained a ``CODEGEN`` option
  34. to mark a custom command's outputs as dependencies of a ``codegen`` target.
  35. See policy :policy:`CMP0171`.
  36. * The :command:`cmake_pkg_config` command was added as an endpoint for using
  37. CMake's native pkg-config format parser. The only supported option in this
  38. release is ``EXTRACT``, which provides low-level access to the values
  39. produced by parsing a pkg-config file. For most users, this is not yet a
  40. suitable replacement for the :module:`FindPkgConfig` module.
  41. * The :command:`file(ARCHIVE_CREATE)` command gained a ``WORKING_DIRECTORY``
  42. option to specify a working directory for the archiving process.
  43. * The :command:`file(MAKE_DIRECTORY)` command gained a ``RESULT`` option
  44. to capture failure in a result variable.
  45. * The :command:`install(FILES)` and :command:`install(DIRECTORY)` commands'
  46. ``TYPE`` argument gained support for a ``LIBEXEC`` type.
  47. Variables
  48. ---------
  49. * The :variable:`CMAKE_AIX_SHARED_LIBRARY_ARCHIVE` variable and corresponding
  50. :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE` target property were added to
  51. create shared libraries on AIX as shared library archives.
  52. * The :variable:`CMAKE_EXPORT_BUILD_DATABASE` variable, a corresponding
  53. :envvar:`CMAKE_EXPORT_BUILD_DATABASE` environment variable, and an
  54. :prop_tgt:`EXPORT_BUILD_DATABASE` target property, were added to
  55. enable exporting C++ module compile commands.
  56. This is only supported with :ref:`Ninja Generators`.
  57. * The :variable:`CMAKE_HOST_EXECUTABLE_SUFFIX` variable was added to
  58. provide the suffix for executable names on the host platform.
  59. * The :variable:`CMAKE_<LANG>_HOST_COMPILER_ID` and
  60. :variable:`CMAKE_<LANG>_HOST_COMPILER_VERSION` variables were added,
  61. where ``<LANG>`` is either ``CUDA`` or ``HIP``. They are populated
  62. when :variable:`CMAKE_<LANG>_COMPILER_ID` is ``NVIDIA`` to identify
  63. NVCC's host compiler.
  64. * The :variable:`CMAKE_<LANG>_STANDARD_LINK_DIRECTORIES` variable was added.
  65. Toolchain files can set this variable to control which link library directory
  66. paths are always passed to the compiler for the specified language.
  67. * The :variable:`CMAKE_LINK_LIBRARIES_STRATEGY` variable and
  68. corresponding :prop_tgt:`LINK_LIBRARIES_STRATEGY` target
  69. property were added to optionally specify the strategy
  70. CMake uses to generate link lines.
  71. Properties
  72. ----------
  73. * The :prop_tgt:`MACOSX_FRAMEWORK_BUNDLE_NAME <MACOSX_FRAMEWORK_INFO_PLIST>`
  74. target property was added to set the ``CFBundleName`` key in an Apple
  75. :prop_tgt:`FRAMEWORK`'s ``Info.plist`` file.
  76. * The :prop_tgt:`UNITY_BUILD` target property now supports the
  77. ``CUDA`` language.
  78. * The :prop_tgt:`VS_FRAMEWORK_REFERENCES` target property was added
  79. to tell :ref:`Visual Studio Generators` to add framework references.
  80. Modules
  81. -------
  82. * Check modules now support a ``CMAKE_REQUIRED_LINK_DIRECTORIES`` variable.
  83. The following modules gained this support:
  84. * :module:`CMakePushCheckState`
  85. * :module:`CheckCCompilerFlag`
  86. * :module:`CheckCSourceCompiles`
  87. * :module:`CheckCSourceRuns`
  88. * :module:`CheckCXXCompilerFlag`
  89. * :module:`CheckCXXSourceCompiles`
  90. * :module:`CheckCXXSourceRuns`
  91. * :module:`CheckCXXSymbolExists`
  92. * :module:`CheckCompilerFlag`
  93. * :module:`CheckFortranCompilerFlag`
  94. * :module:`CheckFortranFunctionExists`
  95. * :module:`CheckFortranSourceCompiles`
  96. * :module:`CheckFortranSourceRuns`
  97. * :module:`CheckFunctionExists`
  98. * :module:`CheckIncludeFile`
  99. * :module:`CheckIncludeFileCXX`
  100. * :module:`CheckIncludeFiles`
  101. * :module:`CheckOBJCCompilerFlag`
  102. * :module:`CheckLibraryExists`
  103. * :module:`CheckOBJCCompilerFlag`
  104. * :module:`CheckOBJCSourceCompiles`
  105. * :module:`CheckOBJCSourceRuns`
  106. * :module:`CheckOBJCXXCompilerFlag`
  107. * :module:`CheckOBJCXXSourceCompiles`
  108. * :module:`CheckOBJCXXSourceRuns`
  109. * :module:`CheckPrototypeDefinition`
  110. * :module:`CheckSourceCompiles`
  111. * :module:`CheckSourceRuns`
  112. * :module:`CheckStructHasMember`
  113. * :module:`CheckSymbolExists`
  114. * :module:`CheckTypeSize`
  115. * :module:`CheckVariableExists`
  116. * The :module:`CMakePackageConfigHelpers` module's
  117. :command:`generate_apple_platform_selection_file` function
  118. gained support for iOS Mac Catalyst.
  119. * The :module:`GoogleTest` module :command:`gtest_discover_tests` command
  120. gained a new ``DISCOVERY_EXTRA_ARGS`` keyword. It allows extra arguments
  121. to be appended to the command line when querying for the list of tests.
  122. * The :module:`FindCUDAToolkit` module now provides a ``CUDA::nvml_static``
  123. target.
  124. * The :module:`FindOpenMP` module gained support for the ``CUDA`` language.
  125. CTest
  126. -----
  127. * The :command:`ctest_submit` command and :option:`ctest -T Submit <ctest -T>`
  128. step now verify TLS server certificates for connections to ``https://`` URLs
  129. by default. See the :variable:`CTEST_TLS_VERIFY` variable for details.
  130. * The :command:`ctest_submit` command and :option:`ctest -T Submit <ctest -T>`
  131. step now require TLS 1.2 or higher for connections to ``https://`` URLs by
  132. default. See the :variable:`CTEST_TLS_VERSION` variable for details.
  133. CPack
  134. -----
  135. * The :cpack_gen:`CPack DEB Generator` gained a
  136. :variable:`CPACK_DEBIAN_PACKAGE_MULTIARCH` option
  137. to support multi-arch packages.
  138. * The :cpack_gen:`CPack IFW Generator` gained the new
  139. :variable:`CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLS` variable to
  140. specify images associated with entries of
  141. :variable:`CPACK_IFW_PACKAGE_PRODUCT_IMAGES`.
  142. This feature is available for QtIFW 4.0 and newer.
  143. * The :cpack_gen:`CPack RPM Generator` gained support for ``zstd`` as a
  144. :variable:`CPACK_RPM_COMPRESSION_TYPE` value.
  145. * The :module:`CPack` module enables per-machine installation by default
  146. in the :cpack_gen:`CPack WIX Generator`. See policy :policy:`CMP0172`
  147. and the :variable:`CPACK_WIX_INSTALL_SCOPE` variable.
  148. Deprecated and Removed Features
  149. ===============================
  150. * Compatibility with versions of CMake older than 3.10 is now deprecated
  151. and will be removed from a future version. Calls to
  152. :command:`cmake_minimum_required` or :command:`cmake_policy` that set
  153. the policy version to an older value now issue a deprecation diagnostic.
  154. * The :module:`CMakeFindFrameworks` module has been deprecated via
  155. :policy:`CMP0173`. Projects should use :command:`find_library` instead.
  156. * The :generator:`Visual Studio 12 2013` generator has been removed.
  157. Other Changes
  158. =============
  159. * When static libraries on link lines are de-duplicated (by policy
  160. :policy:`CMP0156`), the first occurrence is now kept on all platforms.
  161. See policy :policy:`CMP0179`.
  162. * Empty list elements in the :prop_tgt:`TEST_LAUNCHER` and
  163. :prop_tgt:`CROSSCOMPILING_EMULATOR` target properties are now preserved by:
  164. * The :command:`add_test` command.
  165. * The :command:`ExternalData_Add_Test` command from the
  166. :module:`ExternalData` module.
  167. * The :command:`gtest_add_tests` and :command:`gtest_discover_tests`
  168. commands from the :module:`GoogleTest` module.
  169. Empty list elements after the ``EXTRA_ARGS`` keyword of these
  170. two commands are also now preserved.
  171. See policy :policy:`CMP0178`.
  172. * The :command:`execute_process` command's ``ENCODING`` option,
  173. meaningful on Windows, now defaults to ``UTF-8``.
  174. See policy :policy:`CMP0176`.
  175. * The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands now
  176. verify TLS server certificates for connections to ``https://`` URLs by
  177. default. See the :variable:`CMAKE_TLS_VERIFY` variable for details.
  178. This change was made without a policy so that users are protected
  179. even when building projects that have not been updated.
  180. Users may set the :envvar:`CMAKE_TLS_VERIFY` environment
  181. variable to ``0`` to restore the old default.
  182. * The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands now
  183. require TLS 1.2 or higher for connections to ``https://`` URLs by default.
  184. See the :variable:`CMAKE_TLS_VERSION` variable for details.
  185. * The :command:`file(GET_RUNTIME_DEPENDENCIES)` command was updated
  186. to more closely match the dynamic loader's behavior on Linux.
  187. * The :command:`install` command's ``DESTINATION`` arguments are
  188. now :ref:`normalized <Normalization>`, with the exception
  189. of ``INCLUDES DESTINATION`` arguments in :command:`install(TARGETS)`.
  190. See policy :policy:`CMP0177`.
  191. * The :command:`project` command now always sets
  192. :variable:`<PROJECT-NAME>_SOURCE_DIR`, :variable:`<PROJECT-NAME>_BINARY_DIR`,
  193. and :variable:`<PROJECT-NAME>_IS_TOP_LEVEL` as both normal variables and
  194. cache entries. See policy :policy:`CMP0180`.
  195. * The :command:`cmake_parse_arguments(PARSE_ARGV)` command now defines a
  196. variable for an empty string after a single-value keyword. See policy
  197. :policy:`CMP0174`.
  198. Updates
  199. =======
  200. Changes made since CMake 3.31.0 include the following.
  201. 3.31.1, 3.31.2, 3.31.3, 3.31.4, 3.31.5, 3.31.6
  202. ----------------------------------------------
  203. * These versions made no changes to documented features or interfaces.
  204. Some implementation updates were made to support ecosystem changes
  205. and/or fix regressions.