4.1.rst 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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:`project` command now has experimental support for the
  54. ``COMPAT_VERSION`` keyword, gated by
  55. ``CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO``.
  56. Variables
  57. ---------
  58. * The :variable:`CMAKE_FIND_REQUIRED` variable was added to tell
  59. :command:`find_package`, :command:`find_path`, :command:`find_file`,
  60. :command:`find_library`, and :command:`find_program` to be ``REQUIRED``
  61. by default. The commands also gained an ``OPTIONAL`` keyword to ignore
  62. the variable for a specific call.
  63. * The :variable:`CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID` variable is now
  64. populated for most compilers, and documented for public use.
  65. * The :variable:`CMAKE_<LANG>_ICSTAT` variable and corresponding
  66. :prop_tgt:`<LANG>_ICSTAT` target property were added to tell
  67. the :ref:`Makefile Generators` and the :ref:`Ninja Generators`
  68. to run the IAR ``icstat`` tool along with the compiler for
  69. ``C`` and ``CXX`` languages.
  70. Environment Variables
  71. ---------------------
  72. * The :envvar:`CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES_EXCLUDE` environment
  73. variable was added to optionally exclude specific libraries from the
  74. detected set of :variable:`CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES`.
  75. Properties
  76. ----------
  77. * The :prop_tgt:`AUTOMOC_INCLUDE_DIRECTORIES` target property and associated
  78. :variable:`CMAKE_AUTOMOC_INCLUDE_DIRECTORIES` variable were added to
  79. override the automatic discovery of moc includes from a target's transitive
  80. include directories.
  81. * The :prop_sf:`MACOSX_PACKAGE_LOCATION` source file property now
  82. works when set on a source directory, and copies its entire tree
  83. into the bundle.
  84. * The :prop_tgt:`PDB_NAME` and :prop_tgt:`COMPILE_PDB_NAME` target properties
  85. now support :manual:`generator expressions <cmake-generator-expressions(7)>`.
  86. Modules
  87. -------
  88. * The :module:`FindASPELL` module now provides a version variable, imported
  89. targets, and components to optionally select the Aspell library and
  90. executable separately.
  91. * The :module:`FindBLAS` and :module:`FindLAPACK` modules now support the
  92. NVIDIA Performance Libraries (NVPL).
  93. * The :module:`FindProtobuf` module's :command:`protobuf_generate(DEPENDENCIES)`
  94. command argument now accepts multiple values.
  95. * The :module:`FindProtobuf` module's :command:`protobuf_generate_cpp` and
  96. :command:`protobuf_generate_python` commands, together with their
  97. ``Protobuf_IMPORT_DIRS`` and ``PROTOBUF_GENERATE_CPP_APPEND_PATH`` hint
  98. variables, are now deprecated in favor of the :command:`protobuf_generate`
  99. command.
  100. Regular Expressions
  101. -------------------
  102. * The :command:`string(REGEX MATCHALL)`, :command:`string(REGEX REPLACE)`, and
  103. :command:`list(TRANSFORM REPLACE)` commands now match the regular expression
  104. ``^`` anchor at most once in repeated searches, at the start of the input.
  105. See policy :policy:`CMP0186`.
  106. * The :command:`string(REGEX REPLACE)` command now allows references to
  107. unmatched groups. They are replaced with empty strings.
  108. * The :command:`string(REGEX MATCH)`, :command:`string(REGEX MATCHALL)`, and
  109. :command:`string(REGEX REPLACE)` commands now allow zero-length matches.
  110. CTest
  111. -----
  112. * :manual:`ctest(1)` gained a
  113. :option:`--schedule-random-seed <ctest --schedule-random-seed>`
  114. option to specify a numeric random seed to make
  115. :option:`ctest --schedule-random` deterministic for reproduction.
  116. CPack
  117. -----
  118. * The :cpack_gen:`CPack NuGet Generator` gained option
  119. :variable:`CPACK_NUGET_SYMBOL_PACKAGE` to generate NuGet
  120. symbol packages containing PDB files.
  121. * The :cpack_gen:`CPack RPM Generator` gained
  122. :variable:`CPACK_RPM_PACKAGE_ENHANCES`,
  123. :variable:`CPACK_RPM_PACKAGE_RECOMMENDS`, and
  124. :variable:`CPACK_RPM_PACKAGE_SUPPLEMENTS`
  125. variables to specify the corresponding RPM spec fields.
  126. Deprecated and Removed Features
  127. ===============================
  128. * The :module:`FindGTest` module's result variables ``GTEST_INCLUDE_DIRS``,
  129. ``GTEST_LIBRARIES``, ``GTEST_MAIN_LIBRARIES``, and ``GTEST_BOTH_LIBRARIES``
  130. are now deprecated in favor of using ``GTest::gtest`` and
  131. ``GTest::gtest_main`` imported targets.
  132. * The :module:`FindGCCXML` module has been deprecated via policy
  133. :policy:`CMP0188`. Port projects to CastXML instead.
  134. * The :module:`FindCABLE` module has been deprecated via policy
  135. :policy:`CMP0191`.
  136. * The :module:`CMakeDetermineVSServicePack` module has been deprecated
  137. via policy :policy:`CMP0196`. Port projects to the
  138. :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead.
  139. Other Changes
  140. =============
  141. * The :module:`ExternalProject` module no longer checks the ``URL`` archive
  142. file extension. Any archive type that :option:`cmake -E tar <cmake-E tar>`
  143. can extract is now allowed.
  144. * Modules :module:`FindPython3`, :module:`FindPython2` and
  145. :module:`FindPython` now enforce consistency of artifacts in
  146. cross-compiling mode. This prevents mixing host and target artifacts.
  147. See policy :policy:`CMP0190`.
  148. * The :module:`GNUInstallDirs` module now prefers to default
  149. ``SYSCONFDIR``, ``LOCALSTATEDIR``, and ``RUNSTATEDIR`` to
  150. absolute paths when installing to special prefixes.
  151. See policy :policy:`CMP0192`.
  152. * The :module:`GNUInstallDirs` module now caches ``CMAKE_INSTALL_*``
  153. variables with their leading ``usr/`` for install prefix ``/``.
  154. See policy :policy:`CMP0193`.
  155. * The :command:`install(TARGETS)` command no longer ignores file sets which
  156. haven't been defined at the point it is called. The ordering of
  157. :command:`target_sources(FILE_SET)` and ``install(TARGETS)`` is no longer
  158. semantically relevant.
  159. * Enabling ``ASM`` no longer accidentally succeeds using ``MSVC``'s ``cl``
  160. C compiler as an assembler. See policy :policy:`CMP0194`.
  161. * The MSVC link ``-machine:`` flag is no longer added to the
  162. ``CMAKE_*_LINKER_FLAGS`` variables. See policy :policy:`CMP0197`.
  163. * The :genex:`TARGET_PROPERTY` generator expression now evaluates the
  164. :prop_tgt:`LINK_LIBRARIES` and :prop_tgt:`INTERFACE_LINK_LIBRARIES`
  165. target properties transitively. See policy :policy:`CMP0189`.
  166. Updates
  167. =======
  168. Changes made since CMake 4.1.0 include the following.
  169. 4.1.1
  170. -----
  171. * This version made no changes to documented features or interfaces.
  172. Some implementation updates were made to support ecosystem changes
  173. and/or fix regressions.
  174. 4.1.2
  175. -----
  176. * The :command:`file(GENERATE)` command, when evaluating generator
  177. expressions, now uses the value of policy :policy:`CMP0189` as of
  178. each call site. Previously, it used the value as of the end of the
  179. directory's ``CMakeLists.txt``, as all other generator expression
  180. evaluations do.