3.15.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. CMake 3.15 Release Notes
  2. ************************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.14 include the following.
  6. New Features
  7. ============
  8. Generators
  9. ----------
  10. * The :generator:`Xcode` generator now supports per-target schemes.
  11. See the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable and
  12. :prop_tgt:`XCODE_GENERATE_SCHEME` target property.
  13. * The :generator:`Green Hills MULTI` generator has been updated:
  14. * It now supports the :command:`add_custom_command` and
  15. :command:`add_custom_target` commands.
  16. * It is now available on Linux.
  17. Languages
  18. ---------
  19. * Preliminary support for the ``Swift`` language was added to the
  20. :generator:`Ninja` generator:
  21. * Use the :envvar:`SWIFTC` environment variable to specify a compiler.
  22. * The :prop_tgt:`Swift_DEPENDENCIES_FILE` target property and
  23. :prop_sf:`Swift_DEPENDENCIES_FILE` source file property were added
  24. to customize dependency files.
  25. * The :prop_tgt:`Swift_MODULE_NAME` target property was added to
  26. customize the Swift module name.
  27. * The :prop_sf:`Swift_DIAGNOSTICS_FILE` source property was added to
  28. indicate where to write the serialized Swift diagnostics.
  29. The Swift support is experimental, not considered stable, and may change
  30. in future releases of CMake.
  31. Compilers
  32. ---------
  33. * The ``Clang`` compiler variant on Windows that targets the MSVC ABI
  34. but has a GNU-like command line is now supported.
  35. * Support for the Clang-based ARM compiler was added with compiler id
  36. ``ARMClang``.
  37. * Support was added for the IAR compiler architectures Renesas RX,
  38. RL78, RH850 and Texas Instruments MSP430.
  39. * Support was added for the IAR compilers built for Linux (IAR BuildLx).
  40. Command-Line
  41. ------------
  42. * The :envvar:`CMAKE_GENERATOR` environment variable was added
  43. to specify a default generator to use when :manual:`cmake(1)` is
  44. run without a ``-G`` option. Additionally, environment variables
  45. :envvar:`CMAKE_GENERATOR_PLATFORM`, :envvar:`CMAKE_GENERATOR_TOOLSET`,
  46. and :envvar:`CMAKE_GENERATOR_INSTANCE` were created to configure
  47. the generator.
  48. * The :manual:`cmake(1)` ``--build`` tool ``--target`` parameter gained support
  49. for multiple targets, e.g. ``cmake --build . --target Library1 Library2``.
  50. It now also has a short form ``-t`` alias, e.g.
  51. ``cmake --build . -t Library1 Library2``.
  52. * The :manual:`cmake(1)` command gained a new ``--install`` option.
  53. This may be used after building a project to run installation without
  54. using the generated build system or the native build tool.
  55. * The :manual:`cmake(1)` command learned a new CLI option ``--loglevel``.
  56. * The :manual:`cmake(1)` ``-E remove_directory`` command-line tool learned
  57. to support removing multiple directories.
  58. * The :manual:`cmake(1)` ``-E tar`` tool has been improved:
  59. * It now continues adding files to an archive even if some of the files
  60. are not readable. This behavior is more consistent with the
  61. classic ``tar`` tool.
  62. * It now parses all flags, and if an invalid flag was provided, a
  63. warning is issued.
  64. * It now displays an error if no action flag was specified, along with a
  65. list of possible actions: ``t`` (list), ``c`` (create) or ``x`` (extract).
  66. * It now supports extracting (``-x``) or listing (``-t``) only specific
  67. files or directories.
  68. * It now supports Zstandard compression with a ``--zstd`` option.
  69. Zstandard was designed to give a compression ratio comparable to that
  70. of the DEFLATE (zip) algorithm, but faster, especially for decompression.
  71. Commands
  72. --------
  73. * The :command:`add_custom_command` and :command:`add_custom_target` commands
  74. gained a new ``JOB_POOL`` option that works with the :generator:`Ninja`
  75. generator to set the pool variable on the build statement.
  76. * The :command:`add_library` command ``ALIAS`` option learned to support
  77. import libraries of the ``UNKNOWN`` type.
  78. * The :command:`cmake_parse_arguments` command gained an additional
  79. ``<prefix>_KEYWORDS_MISSING_VALUES`` output variable to report
  80. keyword arguments that were given by the caller with no values.
  81. * The :command:`execute_process` command gained a ``COMMAND_ECHO`` option
  82. and supporting :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ECHO` variable
  83. to enable echoing of the command-line string before execution.
  84. * The :command:`file(INSTALL)` command learned a new argument,
  85. ``FOLLOW_SYMLINK_CHAIN``, which can be used to recursively resolve and
  86. install symlinks.
  87. * :command:`list` learned new sub-commands:
  88. ``PREPEND``, ``POP_FRONT`` and ``POP_BACK``.
  89. * The :command:`message` command learned new types:
  90. ``NOTICE``, ``VERBOSE``, ``DEBUG`` and ``TRACE``.
  91. * The :command:`string` learned a new sub-command ``REPEAT``.
  92. Variables
  93. ---------
  94. * The :variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable and corresponding
  95. :prop_tgt:`CROSSCOMPILING_EMULATOR` target property learned to support
  96. arguments to the emulator.
  97. * The :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` variable was added to tell
  98. :command:`find_package` calls to look for a package configuration
  99. file first even if a find module is available.
  100. * The :variable:`CMAKE_FRAMEWORK` variable was added to initialize the
  101. :prop_tgt:`FRAMEWORK` property on all targets.
  102. * The :variable:`CMAKE_VS_JUST_MY_CODE_DEBUGGING` variable and
  103. :prop_tgt:`VS_JUST_MY_CODE_DEBUGGING` target property were added to
  104. enable the Just My Code feature of the Visual Studio Debugger when
  105. compiling with MSVC cl 19.05 and higher.
  106. * The :variable:`CMAKE_MSVC_RUNTIME_LIBRARY` variable and
  107. :prop_tgt:`MSVC_RUNTIME_LIBRARY` target property were introduced to
  108. select the runtime library used by compilers targeting the MSVC ABI.
  109. See policy :policy:`CMP0091`.
  110. * The :variable:`CMAKE_PROJECT_INCLUDE` and
  111. :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` variables were added to allow
  112. injection of custom code at the sites of :command:`project` calls
  113. without knowing the project name a priori.
  114. Properties
  115. ----------
  116. * The :prop_tgt:`ADDITIONAL_CLEAN_FILES` target property and
  117. :prop_dir:`ADDITIONAL_CLEAN_FILES` directory property were added.
  118. They allow to register additional files that should be removed during
  119. the clean stage.
  120. * The :prop_tgt:`PUBLIC_HEADER` and :prop_tgt:`PRIVATE_HEADER` properties
  121. may now be set on :ref:`Interface Libraries`. The headers specified by those
  122. properties can be installed using the :command:`install(TARGETS)` command by
  123. passing the ``PUBLIC_HEADER`` and ``PRIVATE_HEADER`` arguments respectively.
  124. * The :prop_tgt:`VS_PACKAGE_REFERENCES` target property was added to
  125. tell :ref:`Visual Studio Generators` to add references to ``nuget``
  126. packages.
  127. * The :prop_tgt:`VS_PROJECT_IMPORT` target property was added to allow
  128. managed Visual Studio project files to import external ``.props`` files.
  129. * The :prop_tgt:`VS_NO_SOLUTION_DEPLOY` target property was added to
  130. tell :ref:`Visual Studio Generators` whether to deploy an artifact
  131. to the WinCE or Windows Phone target device.
  132. Modules
  133. -------
  134. * The :module:`FindBoost` module was reworked to expose a more consistent
  135. user experience between its "Config" and "Module" modes and with other
  136. find modules in general.
  137. * A new imported target ``Boost::headers`` is now defined (same
  138. as ``Boost::boost``).
  139. * New output variables ``Boost_VERSION_MACRO``,
  140. ``Boost_VERSION_MAJOR``, ``Boost_VERSION_MINOR``,
  141. ``Boost_VERSION_PATCH``, and ``Boost_VERSION_COUNT``
  142. were added.
  143. * The ``QUIET`` argument passed to :command:`find_package` is no
  144. longer ignored in config mode. Note that the CMake package shipped with
  145. Boost ``1.70.0`` ignores the ``QUIET`` argument passed to
  146. :command:`find_package`. This is fixed in the next Boost release.
  147. * The input switch ``Boost_DETAILED_FAILURE_MSG`` was removed.
  148. * ``Boost_VERSION`` now reports the version in ``x.y.z``
  149. format in module mode. See policy :policy:`CMP0093`.
  150. * The :module:`FindCups` module now provides imported targets.
  151. * The :module:`FindEnvModules` module was added to use Lua- and TCL-based
  152. environment modules in :ref:`CTest Scripts <CTest Script>`.
  153. * The :module:`FindGLEW` module now provides an interface more consistent
  154. with what upstream GLEW provides in its own CMake package files.
  155. * The :module:`FindPkgConfig` now populates :prop_tgt:`INTERFACE_LINK_OPTIONS`
  156. property of imported targets with other (non-library) linker flags.
  157. * The :module:`FindPostgreSQL` module learned to find debug and release
  158. variants separately.
  159. * Modules :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  160. gained additional lookup strategies and controls, and a new default.
  161. See policy :policy:`CMP0094`.
  162. * Modules :module:`FindPython`, :module:`FindPython2` and :module:`FindPython3`
  163. gain a new target (respectively ``Python::Module``, ``Python2::Module``
  164. and ``Python3::Module``) which can be used to develop Python modules.
  165. * Modules :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
  166. gain capability to control how virtual environments are handled.
  167. * The :module:`UseSWIG` module learned to manage alternate library names
  168. by passing ``-interface <library_name>`` for ``python`` language or
  169. ``-dllimport <library_name>`` for ``CSharp`` language to the ``SWIG``
  170. compiler.
  171. Generator Expressions
  172. ---------------------
  173. * The :manual:`generator expressions <cmake-generator-expressions(7)>`
  174. ``C_COMPILER_ID``, ``CXX_COMPILER_ID``, ``CUDA_COMPILER_ID``,
  175. ``Fortran_COMPILER_ID``, ``COMPILE_LANGUAGE``, ``COMPILE_LANG_AND_ID``, and
  176. ``PLATFORM_ID`` learned to support matching one value from a comma-separated
  177. list.
  178. * The ``$<CUDA_COMPILER_ID:...>`` and ``$<CUDA_COMPILER_VERSION:...>``
  179. :manual:`generator expressions <cmake-generator-expressions(7)>` were added.
  180. * The ``$<COMPILE_LANG_AND_ID:...>`` generator expression was introduced to
  181. allow specification of compile options for target files based on the
  182. :variable:`CMAKE_<LANG>_COMPILER_ID` and :prop_sf:`LANGUAGE` of
  183. each source file.
  184. * A ``$<FILTER:list,INCLUDE|EXCLUDE,regex>``
  185. :manual:`generator expression <cmake-generator-expressions(7)>`
  186. has been added.
  187. * A ``$<REMOVE_DUPLICATES:list>``
  188. :manual:`generator expression <cmake-generator-expressions(7)>`
  189. has been added.
  190. * The ``$<SHELL_PATH:...>`` :manual:`generator expression
  191. <cmake-generator-expressions(7)>` gained support for a list of paths.
  192. * New ``$<TARGET_FILE*>`` :manual:`generator expressions
  193. <cmake-generator-expressions(7)>` were added to retrieve the prefix, base
  194. name, and suffix of the file names of various artifacts:
  195. * ``$<TARGET_FILE_PREFIX:...>``
  196. * ``$<TARGET_FILE_BASE_NAME:...>``
  197. * ``$<TARGET_FILE_SUFFIX:...>``
  198. * ``$<TARGET_LINKER_FILE_PREFIX:...>``
  199. * ``$<TARGET_LINKER_FILE_BASE_NAME:...>``
  200. * ``$<TARGET_LINKER_FILE_SUFFIX:...>``
  201. * ``$<TARGET_PDB_FILE_BASE_NAME:...>``
  202. * The ``$<TARGET_OBJECTS:...>`` :manual:`generator expression
  203. <cmake-generator-expressions(7)>` is now supported on ``SHARED``,
  204. ``STATIC``, ``MODULE`` libraries and executables.
  205. CTest
  206. -----
  207. * The :command:`ctest_submit` command learned a new option: ``BUILD_ID``.
  208. This can be used to store the ID assigned to this build by CDash to a
  209. variable.
  210. * The :command:`ctest_update` command learned to honor a new variable:
  211. :variable:`CTEST_UPDATE_VERSION_OVERRIDE`. This can be used to specify
  212. the current version of your source tree rather than using the update
  213. command to discover the current version that is checked out.
  214. CPack
  215. -----
  216. * The :cpack_gen:`CPack IFW Generator` gained a new
  217. :variable:`CPACK_IFW_PACKAGE_STYLE_SHEET` variable to customize the
  218. installer stylesheet.
  219. Deprecated and Removed Features
  220. ===============================
  221. * The :manual:`cmake-server(7)` mode has been deprecated and will be
  222. removed from a future version of CMake. Please port clients to use
  223. the :manual:`cmake-file-api(7)` instead.
  224. * The :prop_dir:`ADDITIONAL_MAKE_CLEAN_FILES` directory property is now
  225. deprecated. Use the :prop_dir:`ADDITIONAL_CLEAN_FILES` directory property
  226. instead.
  227. * The variable :variable:`CMAKE_AUTOMOC_RELAXED_MODE` is considered
  228. deprecated. Support still exists but will be removed in future versions.
  229. * The :command:`export(PACKAGE)` command now does nothing unless
  230. enabled via :variable:`CMAKE_EXPORT_PACKAGE_REGISTRY`.
  231. See policy :policy:`CMP0090`.
  232. * The :generator:`Xcode` generator now requires at least Xcode 5.
  233. * An explicit deprecation diagnostic was added for policy ``CMP0066``
  234. (``CMP0065`` and below were already deprecated).
  235. The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
  236. of all policies are deprecated and that projects should port to the
  237. NEW behaviors.
  238. Other Changes
  239. =============
  240. * If a feature specified by :command:`target_compile_features` is available
  241. in the compiler's default standard level, CMake 3.14 and below incorrectly
  242. added unnecessary ``-std=`` flags that could lower the standard level.
  243. This bug has been fixed in CMake 3.15. This behavior change may expose
  244. bugs in existing projects that were relying on undocumented implementation
  245. details. Specifying compile features only ensures that the compiler runs
  246. in a mode that has those features, not that any specific standard level is
  247. used or explicit ``-std=`` flag passed.
  248. * CMake learned how to compile C++14 with the IBM AIX XL compiler
  249. and the SunPro compiler and to compile C++20 with the AppleClang compiler.
  250. * With MSVC-like compilers the value of :variable:`CMAKE_<LANG>_FLAGS`
  251. no longer contains warning flags like ``/W3`` by default.
  252. See policy :policy:`CMP0092`.
  253. * IBM Clang-based XL compilers that define ``__ibmxl__`` now use the
  254. compiler id ``XLClang`` instead of ``XL``. See policy :policy:`CMP0089`.
  255. * The :command:`file(REMOVE)` and :command:`file(REMOVE_RECURSE)` commands
  256. were changed to ignore empty arguments with a warning instead of treating
  257. them as a relative path and removing the contents of the current directory.
  258. Updates
  259. =======
  260. Changes made since CMake 3.15.0 include the following.
  261. 3.15.1
  262. ------
  263. * In CMake 3.15.0 support for the GNU-like ``Clang`` compiler targeting the
  264. MSVC ABI implemented :variable:`CMAKE_CXX_STANDARD` values 98 and 11 using
  265. the corresponding ``-std=`` flags. However, these modes do not work with
  266. the MSVC standard library. Therefore CMake 3.15.1 passes C++14 standard
  267. flags even for C++98 and C++11. This is consistent with MSVC itself which
  268. always runs in a mode aware of C++14.
  269. * Preliminary Swift support added in 3.15.0 has been updated.
  270. 3.15.2
  271. ------
  272. * In CMake 3.15.0 and 3.15.1 the :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG`
  273. variable caused the :command:`find_package` command to fail on a missing
  274. package even without the ``REQUIRED`` option. This has been fixed.
  275. 3.15.3
  276. ------
  277. * ``CrayPrgEnv`` compiler wrapper support has been updated for the 19.06
  278. release of the Cray Programming Environment for which the default linking
  279. mode on XC Cray systems is now dynamic instead of static.
  280. 3.15.4
  281. ------
  282. * In CMake 3.15.0 through 3.15.3, the :prop_dir:`EXCLUDE_FROM_ALL`
  283. directory property was regressed from pre-3.14 behavior and caused
  284. targets within the directory to be excluded even from its own "all".
  285. This has been fixed.
  286. The bug also existed in 3.14.0 through 3.14.6 and is fixed in 3.14.7.