3.31.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. * The :envvar:`CMAKE_CONFIG_DIR` environment variable was added to specify a
  72. CMake user-wide configuration directory for :manual:`cmake-file-api(7)`
  73. queries.
  74. Properties
  75. ----------
  76. * The :prop_tgt:`MACOSX_FRAMEWORK_BUNDLE_NAME <MACOSX_FRAMEWORK_INFO_PLIST>`
  77. target property was added to set the ``CFBundleName`` key in an Apple
  78. :prop_tgt:`FRAMEWORK`'s ``Info.plist`` file.
  79. * The :prop_tgt:`UNITY_BUILD` target property now supports the
  80. ``CUDA`` language.
  81. * The :prop_tgt:`VS_FRAMEWORK_REFERENCES` target property was added
  82. to tell :ref:`Visual Studio Generators` to add framework references.
  83. Modules
  84. -------
  85. * Check modules now support a ``CMAKE_REQUIRED_LINK_DIRECTORIES`` variable.
  86. The following modules gained this support:
  87. * :module:`CMakePushCheckState`
  88. * :module:`CheckCCompilerFlag`
  89. * :module:`CheckCSourceCompiles`
  90. * :module:`CheckCSourceRuns`
  91. * :module:`CheckCXXCompilerFlag`
  92. * :module:`CheckCXXSourceCompiles`
  93. * :module:`CheckCXXSourceRuns`
  94. * :module:`CheckCXXSymbolExists`
  95. * :module:`CheckCompilerFlag`
  96. * :module:`CheckFortranCompilerFlag`
  97. * :module:`CheckFortranFunctionExists`
  98. * :module:`CheckFortranSourceCompiles`
  99. * :module:`CheckFortranSourceRuns`
  100. * :module:`CheckFunctionExists`
  101. * :module:`CheckIncludeFile`
  102. * :module:`CheckIncludeFileCXX`
  103. * :module:`CheckIncludeFiles`
  104. * :module:`CheckOBJCCompilerFlag`
  105. * :module:`CheckLibraryExists`
  106. * :module:`CheckOBJCCompilerFlag`
  107. * :module:`CheckOBJCSourceCompiles`
  108. * :module:`CheckOBJCSourceRuns`
  109. * :module:`CheckOBJCXXCompilerFlag`
  110. * :module:`CheckOBJCXXSourceCompiles`
  111. * :module:`CheckOBJCXXSourceRuns`
  112. * :module:`CheckPrototypeDefinition`
  113. * :module:`CheckSourceCompiles`
  114. * :module:`CheckSourceRuns`
  115. * :module:`CheckStructHasMember`
  116. * :module:`CheckSymbolExists`
  117. * :module:`CheckTypeSize`
  118. * :module:`CheckVariableExists`
  119. * The :module:`CMakePackageConfigHelpers` module's
  120. :command:`generate_apple_platform_selection_file` function
  121. gained support for iOS Mac Catalyst.
  122. * The :module:`GoogleTest` module :command:`gtest_discover_tests` command
  123. gained a new ``DISCOVERY_EXTRA_ARGS`` keyword. It allows extra arguments
  124. to be appended to the command line when querying for the list of tests.
  125. * The :module:`FindCUDAToolkit` module now provides a ``CUDA::nvml_static``
  126. target.
  127. * The :module:`FindOpenMP` module gained support for the ``CUDA`` language.
  128. CTest
  129. -----
  130. * The :command:`ctest_submit` command and :option:`ctest -T Submit <ctest -T>`
  131. step now verify TLS server certificates for connections to ``https://`` URLs
  132. by default. See the :variable:`CTEST_TLS_VERIFY` variable for details.
  133. * The :command:`ctest_submit` command and :option:`ctest -T Submit <ctest -T>`
  134. step now require TLS 1.2 or higher for connections to ``https://`` URLs by
  135. default. See the :variable:`CTEST_TLS_VERSION` variable for details.
  136. CPack
  137. -----
  138. * The :cpack_gen:`CPack DEB Generator` gained a
  139. :variable:`CPACK_DEBIAN_PACKAGE_MULTIARCH` option
  140. to support multi-arch packages.
  141. * The :cpack_gen:`CPack IFW Generator` gained the new
  142. :variable:`CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLS` variable to
  143. specify images associated with entries of
  144. :variable:`CPACK_IFW_PACKAGE_PRODUCT_IMAGES`.
  145. This feature is available for QtIFW 4.0 and newer.
  146. * The :cpack_gen:`CPack RPM Generator` gained support for ``zstd`` as a
  147. :variable:`CPACK_RPM_COMPRESSION_TYPE` value.
  148. * The :module:`CPack` module enables per-machine installation by default
  149. in the :cpack_gen:`CPack WIX Generator`. See policy :policy:`CMP0172`
  150. and the :variable:`CPACK_WIX_INSTALL_SCOPE` variable.
  151. Deprecated and Removed Features
  152. ===============================
  153. * Compatibility with versions of CMake older than 3.10 is now deprecated
  154. and will be removed from a future version. Calls to
  155. :command:`cmake_minimum_required` or :command:`cmake_policy` that set
  156. the policy version to an older value now issue a deprecation diagnostic.
  157. * The :module:`CMakeFindFrameworks` module has been deprecated via
  158. :policy:`CMP0173`. Projects should use :command:`find_library` instead.
  159. * The :generator:`Visual Studio 12 2013` generator has been removed.
  160. Other Changes
  161. =============
  162. * When static libraries on link lines are de-duplicated (by policy
  163. :policy:`CMP0156`), the first occurrence is now kept on all platforms.
  164. See policy :policy:`CMP0179`.
  165. * Empty list elements in the :prop_tgt:`TEST_LAUNCHER` and
  166. :prop_tgt:`CROSSCOMPILING_EMULATOR` target properties are now preserved by:
  167. * The :command:`add_test` command.
  168. * The :command:`ExternalData_Add_Test` command from the
  169. :module:`ExternalData` module.
  170. * The :command:`gtest_add_tests` and :command:`gtest_discover_tests`
  171. commands from the :module:`GoogleTest` module.
  172. Empty list elements after the ``EXTRA_ARGS`` keyword of these
  173. two commands are also now preserved.
  174. See policy :policy:`CMP0178`.
  175. * The :command:`execute_process` command's ``ENCODING`` option,
  176. meaningful on Windows, now defaults to ``UTF-8``.
  177. See policy :policy:`CMP0176`.
  178. * The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands now
  179. verify TLS server certificates for connections to ``https://`` URLs by
  180. default. See the :variable:`CMAKE_TLS_VERIFY` variable for details.
  181. This change was made without a policy so that users are protected
  182. even when building projects that have not been updated.
  183. Users may set the :envvar:`CMAKE_TLS_VERIFY` environment
  184. variable to ``0`` to restore the old default.
  185. * The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands now
  186. require TLS 1.2 or higher for connections to ``https://`` URLs by default.
  187. See the :variable:`CMAKE_TLS_VERSION` variable for details.
  188. * The :command:`file(GET_RUNTIME_DEPENDENCIES)` command was updated
  189. to more closely match the dynamic loader's behavior on Linux.
  190. * The :command:`install` command's ``DESTINATION`` arguments are
  191. now :ref:`normalized <Normalization>`, with the exception
  192. of ``INCLUDES DESTINATION`` arguments in :command:`install(TARGETS)`.
  193. See policy :policy:`CMP0177`.
  194. * The :command:`project` command now always sets
  195. :variable:`<PROJECT-NAME>_SOURCE_DIR`, :variable:`<PROJECT-NAME>_BINARY_DIR`,
  196. and :variable:`<PROJECT-NAME>_IS_TOP_LEVEL` as both normal variables and
  197. cache entries. See policy :policy:`CMP0180`.
  198. * The :command:`cmake_parse_arguments(PARSE_ARGV)` command now defines a
  199. variable for an empty string after a single-value keyword. See policy
  200. :policy:`CMP0174`.
  201. Updates
  202. =======
  203. Changes made since CMake 3.31.0 include the following.
  204. 3.31.1, 3.31.2, 3.31.3, 3.31.4, 3.31.5, 3.31.6, 3.31.7, 3.31.8, 3.31.9
  205. ----------------------------------------------------------------------
  206. * These versions made no changes to documented features or interfaces.
  207. Some implementation updates were made to support ecosystem changes
  208. and/or fix regressions.
  209. 3.31.10
  210. -------
  211. * The :command:`execute_process` command once again terminates child
  212. processes when its ``TIMEOUT`` is reached. This was accidentally
  213. regressed by CMake 3.29.