4.1.rst 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. CMake 4.1 Release Notes
  2. ***********************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 4.0 include the following.
  6. New Features
  7. ============
  8. File-Based API
  9. --------------
  10. * The :manual:`cmake-file-api(7)` :ref:`v1 <file-api v1>` now writes
  11. partial replies when buildsystem generation fails with an error.
  12. See the :ref:`v1 Reply Error Index <file-api reply error index>`.
  13. Generators
  14. ----------
  15. * :ref:`Makefile Generators` and :ref:`Ninja Generators` gained support
  16. for adding a linker launcher with ``Fortran``, ``CUDA``, and ``HIP``.
  17. See the :variable:`CMAKE_<LANG>_LINKER_LAUNCHER` variable
  18. and :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property for details.
  19. Command-Line
  20. ------------
  21. * The :ref:`cmake --build <Build Tool Mode>` command-line tool, when used
  22. with the :generator:`Xcode` generator, now detects when a third-party
  23. tool has wrapped the generated ``.xcodeproj`` in a ``.xcworkspace``,
  24. and drives the build through the workspace instead.
  25. Configure Log
  26. -------------
  27. * The :manual:`cmake-configure-log(7)` now reports events from
  28. :command:`find_package` (in ``CONFIG`` mode), :command:`find_path`,
  29. :command:`find_file`, :command:`find_library`, and :command:`find_program`
  30. commands when first invoked, when their results transition between
  31. "not found" and "found", or when enabled explicitly by the
  32. :option:`--debug-find <cmake --debug-find>` command-line option.
  33. See :ref:`find configure-log event` and
  34. :ref:`find_package configure-log event`. Logging may also be controlled
  35. by the :variable:`CMAKE_FIND_DEBUG_MODE` and
  36. :variable:`CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG` variables.
  37. Compilers
  38. ---------
  39. * `Diab compilers from Wind River Systems`_, versions 5.9.x+, are now
  40. supported with :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` ``Diab``
  41. for languages ``ASM``, ``C``, and ``CXX``.
  42. .. _`Diab compilers from Wind River Systems`: https://www.windriver.com/resource/wind-river-diab-compiler-product-overview
  43. * `Renesas Compilers`_ are now supported with
  44. :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` ``Renesas`` for
  45. languages ``ASM`` and ``C``.
  46. .. _Renesas Compilers: https://www.renesas.com
  47. Commands
  48. --------
  49. * The :command:`add_dependencies` command may be called with no dependencies.
  50. * The :command:`cmake_pkg_config` command now supports the ``IMPORT`` and
  51. ``POPULATE`` subcommands for interfacing CMake targets with pkg-config based
  52. dependencies.
  53. * The :command:`install(DIRECTORY)` command gained a new
  54. ``EXCLUDE_EMPTY_DIRECTORIES`` option to skip installation
  55. of empty directories.
  56. * The :command:`project` command now has experimental support for the
  57. ``COMPAT_VERSION`` keyword, gated by
  58. ``CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO``.
  59. Variables
  60. ---------
  61. * The :variable:`CMAKE_FIND_REQUIRED` variable was added to tell
  62. :command:`find_package`, :command:`find_path`, :command:`find_file`,
  63. :command:`find_library`, and :command:`find_program` to be ``REQUIRED``
  64. by default. The commands also gained an ``OPTIONAL`` keyword to ignore
  65. the variable for a specific call.
  66. * The :variable:`CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID` variable is now
  67. populated for most compilers, and documented for public use.
  68. * The :variable:`CMAKE_<LANG>_ICSTAT` variable and corresponding
  69. :prop_tgt:`<LANG>_ICSTAT` target property were added to tell
  70. the :ref:`Makefile Generators` and the :ref:`Ninja Generators`
  71. to run the IAR ``icstat`` tool along with the compiler for
  72. ``C`` and ``CXX`` languages.
  73. Environment Variables
  74. ---------------------
  75. * The :envvar:`CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES_EXCLUDE` environment
  76. variable was added to optionally exclude specific libraries from the
  77. detected set of :variable:`CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES`.
  78. Properties
  79. ----------
  80. * The :prop_tgt:`AUTOMOC_INCLUDE_DIRECTORIES` target property and associated
  81. :variable:`CMAKE_AUTOMOC_INCLUDE_DIRECTORIES` variable were added to
  82. override the automatic discovery of moc includes from a target's transitive
  83. include directories.
  84. * The :prop_sf:`MACOSX_PACKAGE_LOCATION` source file property now
  85. works when set on a source directory, and copies its entire tree
  86. into the bundle.
  87. * The :prop_tgt:`PDB_NAME` and :prop_tgt:`COMPILE_PDB_NAME` target properties
  88. now support :manual:`generator expressions <cmake-generator-expressions(7)>`.
  89. Modules
  90. -------
  91. * The :module:`FindASPELL` module now provides a version variable, imported
  92. targets, and components to optionally select the Aspell library and
  93. executable separately.
  94. * The :module:`FindBLAS` and :module:`FindLAPACK` modules now support the
  95. NVIDIA Performance Libraries (NVPL).
  96. * The :module:`FindProtobuf` module's :command:`protobuf_generate(DEPENDENCIES)`
  97. command argument now accepts multiple values.
  98. * The :module:`FindProtobuf` module's :command:`protobuf_generate_cpp` and
  99. :command:`protobuf_generate_python` commands, together with their
  100. ``Protobuf_IMPORT_DIRS`` and ``PROTOBUF_GENERATE_CPP_APPEND_PATH`` hint
  101. variables, are now deprecated in favor of the :command:`protobuf_generate`
  102. command.
  103. Regular Expressions
  104. -------------------
  105. * The :command:`string(REGEX MATCHALL)`, :command:`string(REGEX REPLACE)`, and
  106. :command:`list(TRANSFORM REPLACE)` commands now match the regular expression
  107. ``^`` anchor at most once in repeated searches, at the start of the input.
  108. See policy :policy:`CMP0186`.
  109. * The :command:`string(REGEX REPLACE)` command now allows references to
  110. unmatched groups. They are replaced with empty strings.
  111. * The :command:`string(REGEX MATCH)`, :command:`string(REGEX MATCHALL)`, and
  112. :command:`string(REGEX REPLACE)` commands now allow zero-length matches.
  113. CTest
  114. -----
  115. * :manual:`ctest(1)` gained a
  116. :option:`--schedule-random-seed <ctest --schedule-random-seed>`
  117. option to specify a numeric random seed to make
  118. :option:`ctest --schedule-random` deterministic for reproduction.
  119. CPack
  120. -----
  121. * The :cpack_gen:`CPack NuGet Generator` gained option
  122. :variable:`CPACK_NUGET_SYMBOL_PACKAGE` to generate NuGet
  123. symbol packages containing PDB files.
  124. * The :cpack_gen:`CPack RPM Generator` gained
  125. :variable:`CPACK_RPM_PACKAGE_ENHANCES`,
  126. :variable:`CPACK_RPM_PACKAGE_RECOMMENDS`, and
  127. :variable:`CPACK_RPM_PACKAGE_SUPPLEMENTS`
  128. variables to specify the corresponding RPM spec fields.
  129. Deprecated and Removed Features
  130. ===============================
  131. * The :module:`FindGTest` module's result variables ``GTEST_INCLUDE_DIRS``,
  132. ``GTEST_LIBRARIES``, ``GTEST_MAIN_LIBRARIES``, and ``GTEST_BOTH_LIBRARIES``
  133. are now deprecated in favor of using ``GTest::gtest`` and
  134. ``GTest::gtest_main`` imported targets.
  135. * The :module:`FindGCCXML` module has been deprecated via policy
  136. :policy:`CMP0188`. Port projects to CastXML instead.
  137. * The :module:`FindCABLE` module has been deprecated via policy
  138. :policy:`CMP0191`.
  139. * The :module:`CMakeDetermineVSServicePack` module has been deprecated
  140. via policy :policy:`CMP0196`. Port projects to the
  141. :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead.
  142. Other Changes
  143. =============
  144. * The :module:`ExternalProject` module no longer checks the ``URL`` archive
  145. file extension. Any archive type that :option:`cmake -E tar <cmake-E tar>`
  146. can extract is now allowed.
  147. * Modules :module:`FindPython3`, :module:`FindPython2` and
  148. :module:`FindPython` now enforce consistency of artifacts in
  149. cross-compiling mode. This prevents mixing host and target artifacts.
  150. See policy :policy:`CMP0190`.
  151. * The :module:`GNUInstallDirs` module now prefers to default
  152. ``SYSCONFDIR``, ``LOCALSTATEDIR``, and ``RUNSTATEDIR`` to
  153. absolute paths when installing to special prefixes.
  154. See policy :policy:`CMP0192`.
  155. * The :module:`GNUInstallDirs` module now caches ``CMAKE_INSTALL_*``
  156. variables with their leading ``usr/`` for install prefix ``/``.
  157. See policy :policy:`CMP0193`.
  158. * The :command:`install(TARGETS)` command no longer ignores file sets which
  159. haven't been defined at the point it is called. The ordering of
  160. :command:`target_sources(FILE_SET)` and ``install(TARGETS)`` is no longer
  161. semantically relevant.
  162. * Enabling ``ASM`` no longer accidentally succeeds using ``MSVC``'s ``cl``
  163. C compiler as an assembler. See policy :policy:`CMP0194`.
  164. * The MSVC link ``-machine:`` flag is no longer added to the
  165. ``CMAKE_*_LINKER_FLAGS`` variables. See policy :policy:`CMP0197`.
  166. * The :genex:`TARGET_PROPERTY` generator expression now evaluates the
  167. :prop_tgt:`LINK_LIBRARIES` and :prop_tgt:`INTERFACE_LINK_LIBRARIES`
  168. target properties transitively. See policy :policy:`CMP0189`.