3.14.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. CMake 3.14 Release Notes
  2. ************************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.13 include the following.
  6. New Features
  7. ============
  8. Generators
  9. ----------
  10. * The :generator:`Visual Studio 16 2019` generator was added. This is
  11. experimental and based on "Visual Studio 2019 Preview 2" because this
  12. version of VS has not been released.
  13. The VS 2019 generator differs from generators for earlier versions
  14. in that it does not provide variants that specify the target platform
  15. in the generator name. Instead :variable:`CMAKE_GENERATOR_PLATFORM`
  16. must be used, e.g. through the ``-A`` command-line option. Furthermore,
  17. the default target platform (architecture) is now based on the *host*
  18. platform. The VS host toolset selection is now based on the host
  19. architecture as well.
  20. File-Based API
  21. --------------
  22. * A file-based api for clients to get semantic buildsystem information
  23. has been added. See the :manual:`cmake-file-api(7)` manual.
  24. This is intended to replace the :manual:`cmake-server(7)` mode for IDEs.
  25. Platforms
  26. ---------
  27. * CMake now supports :ref:`Cross Compiling for iOS, tvOS, or watchOS`
  28. using simple toolchain files.
  29. Command-Line
  30. ------------
  31. * The :manual:`cmake(1)` :ref:`Build Tool Mode <Build Tool Mode>`
  32. (``cmake --build``) gained ``--verbose`` and ``-v`` options to
  33. specify verbose build output. Some generators such as Xcode don't
  34. support this option currently.
  35. * The :manual:`cmake(1)` ``-E compare_files`` command learned a new
  36. ``--ignore-eol`` option to specify that end-of-line differences
  37. (e.g. LF vs CRLF) should be ignored when comparing files.
  38. * The :manual:`cmake-gui(1)` dialog gained new ``-S`` and ``-B`` arguments to
  39. explicitly specify source and build directories.
  40. Commands
  41. --------
  42. * The :command:`file` command learned a new sub-command, ``READ_SYMLINK``,
  43. which can be used to determine the path that a symlink points to.
  44. * The :command:`file` command gained a ``SIZE`` mode to get the size
  45. of a file on disk.
  46. * The :command:`find_package` command learned to optionally resolve
  47. symbolic links in the paths to package configuration files.
  48. See the :variable:`CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS` variable.
  49. * The :command:`get_filename_component` command gained new
  50. ``LAST_EXT`` and ``NAME_WLE`` variants to work with the
  51. extension after the last ``.`` in the name.
  52. * The :command:`if` command gained support for checking if cache variables
  53. are defined with the ``DEFINED CACHE{VAR}`` syntax.
  54. * The :command:`install(CODE)` and :command:`install(SCRIPT)` commands
  55. learned to support generator expressions. See policy :policy:`CMP0087`.
  56. * The :command:`install(TARGETS)` command learned how to install to an
  57. appropriate default directory for a given target type, based on
  58. variables from the :module:`GNUInstallDirs` module and built-in defaults,
  59. in lieu of a ``DESTINATION`` argument.
  60. * The :command:`install(FILES)` and :command:`install(DIRECTORY)` commands
  61. learned a new set of parameters for installing files as a file type,
  62. setting the destination based on the appropriate variables from
  63. :module:`GNUInstallDirs` and built-in defaults, in lieu of a
  64. ``DESTINATION`` argument.
  65. * The :command:`list` operations ``REMOVE_ITEM``, ``REMOVE_DUPLICATES``,
  66. ``SORT``, ``REVERSE``, and ``FILTER`` all now accept a non-existent variable
  67. as the list since these operations on empty lists is also the empty list.
  68. * The :command:`list` operation ``REMOVE_AT`` now indicates that the given
  69. indices are invalid for a non-existent variable or empty list.
  70. * The :command:`try_compile` and :command:`try_run` commands gained a new
  71. ``LINK_OPTIONS`` option.
  72. Variables
  73. ---------
  74. * A :variable:`CMAKE_BUILD_RPATH_USE_ORIGIN` variable and corresponding
  75. :prop_tgt:`BUILD_RPATH_USE_ORIGIN` target property were added to
  76. enable use of relative runtime paths (RPATHs). This helps achieving
  77. relocatable and reproducible builds that are invariant of the build
  78. directory.
  79. Properties
  80. ----------
  81. * A :prop_gbl:`CMAKE_ROLE` global property was added to allow scripts to
  82. determine whether they're running in project mode, script mode,
  83. find-package mode, CTest, or CPack.
  84. * The :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` target property is now supported
  85. on shared library, module library, and executable targets. Previously it was
  86. only honored on static libraries.
  87. * The :prop_tgt:`EXCLUDE_FROM_ALL` target property was created to override
  88. the setting of its directory. A target will now be built as part of "all"
  89. if its :prop_tgt:`EXCLUDE_FROM_ALL` property is set to ``OFF``, even if its
  90. containing directory is marked as :prop_dir:`EXCLUDE_FROM_ALL`.
  91. * :prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE` target property gains the
  92. support of :manual:`generator expressions <cmake-generator-expressions(7)>`.
  93. Modules
  94. -------
  95. * The family of modules to check capabilities (like
  96. :module:`CheckCSourceCompiles`) gain capability to manage ``LINK_OPTIONS``.
  97. * A :module:`CheckFortranSourceRuns` module was added to provide a
  98. :command:`check_fortran_source_runs` command to check if a Fortran
  99. source snippet compiles and runs.
  100. * The :module:`ExternalProject` module :command:`ExternalProject_Add` command
  101. gained ``LOG_DIR`` and ``LOG_MERGED_STDOUTERR`` options to control logging.
  102. * The :module:`ExternalProject` module :command:`ExternalProject_Add` command
  103. gained ``LOG_PATCH`` to optionally log the patch step.
  104. * The :module:`ExternalProject` module's ``ExternalProject_Add`` command
  105. learned to apply ``SOURCE_SUBDIR`` when ``BUILD_IN_SOURCE`` is also used.
  106. The ``BUILD_COMMAND`` is run in the given ``SOURCE_SUBDIR`` of the
  107. ``SOURCE_DIR``.
  108. * The :module:`FetchContent` module gained a new
  109. :command:`FetchContent_MakeAvailable` command. It accepts a list of
  110. dependency names, which it then iterates over, populating and adding
  111. each one to the main build using the canonical pattern. This
  112. significantly reduces the amount of boilerplate needed in a project.
  113. * The :module:`FindBISON` module's ``BISON_TARGET`` command now runs ``bison``
  114. with :variable:`CMAKE_CURRENT_BINARY_DIR` as the working directory.
  115. See policy :policy:`CMP0088`.
  116. * The :module:`FindCURL` module gained support for requesting
  117. protocols as package components.
  118. * The :module:`FindFontconfig` module was added to find `fontconfig`_.
  119. * The :module:`FindGDAL` module now provides imported targets.
  120. * The :module:`FindGIF` module now provides imported targets.
  121. * The :module:`FindGit` module now provides an imported target for the
  122. Git executable.
  123. * The :module:`FindIce` module learned to find ``slice2confluence``
  124. and ``slice2matlab``.
  125. * The :module:`FindLibinput` module was added to find `libinput`_.
  126. * The :module:`FindLibLZMA` module now provides imported targets.
  127. * The :module:`FindMatlab` module gained new options ``R2017b`` and
  128. ``R2018a`` to specify the MEX API version to use; these options
  129. mirror the new options to the ``mex`` command in MATLAB R2018a.
  130. The option ``MX_LIBRARY`` is no longer needed.
  131. * A :module:`FindOctave` module was added to find GNU octave.
  132. * The :module:`FindPostgreSQL` module now provides imported targets.
  133. * The :module:`FindPython`, :module:`FindPython2`, and :module:`FindPython3`
  134. modules gained support for ``NumPy`` component.
  135. * The :module:`FindPython2`, :module:`FindPython3`, and :module:`FindPython`
  136. modules now support running in script mode by skipping the creation of
  137. imported targets and helper functions.
  138. * The :module:`FindSQLite3` module was added to find the SQLite v3.x library.
  139. * The :module:`FindX11` had the following variables renamed in order to match
  140. their library names rather than header names. The old variables are provided
  141. for compatibility:
  142. - ``X11_Xxf86misc_INCLUDE_PATH`` instead of ``X11_xf86misc_INCLUDE_PATH``
  143. - ``X11_Xxf86misc_LIB`` instead of ``X11_xf86misc_LIB``
  144. - ``X11_Xxf86misc_FOUND`` instead of ``X11_xf86misc_FOUND``
  145. - ``X11_Xxf86vm_INCLUDE_PATH`` instead of ``X11_xf86vmode_INCLUDE_PATH``
  146. - ``X11_Xxf86vm_LIB`` instead of ``X11_xf86vmode_LIB``
  147. - ``X11_Xxf86vm_FOUND`` instead of ``X11_xf86vmode_FOUND``
  148. - ``X11_xkbfile_INCLUDE_PATH`` instead of ``X11_Xkbfile_INCLUDE_PATH``
  149. - ``X11_xkbfile_LIB`` instead of ``X11_Xkbfile_LIB``
  150. - ``X11_xkbfile_FOUND`` instead of ``X11_Xkbfile_FOUND``
  151. - ``X11_Xtst_INCLUDE_PATH`` instead of ``X11_XTest_INCLUDE_PATH``
  152. - ``X11_Xtst_LIB`` instead of ``X11_XTest_LIB``
  153. - ``X11_Xtst_FOUND`` instead of ``X11_XTest_FOUND``
  154. - ``X11_Xss_INCLUDE_PATH`` instead of ``X11_Xscreensaver_INCLUDE_PATH``
  155. - ``X11_Xss_LIB`` instead of ``X11_Xscreensaver_LIB``
  156. - ``X11_Xss_FOUND`` instead of ``X11_Xscreensaver_FOUND``
  157. The following variables are deprecated completely since they were
  158. essentially duplicates:
  159. - ``X11_Xinput_INCLUDE_PATH`` (use ``X11_Xi_INCLUDE_PATH``)
  160. - ``X11_Xinput_LIB`` (use ``X11_Xi_LIB``)
  161. - ``X11_Xinput_FOUND`` (use ``X11_Xi_FOUND``)
  162. * The :module:`FindX11` now provides ``X11_Xext_INCLUDE_PATH``.
  163. * The :module:`FindX11` now provides imported targets.
  164. * The :module:`UseSWIG` module learned to pass ``-module <module_name>`` to
  165. the ``SWIG`` compiler if the file property ``SWIG_MODULE_NAME`` is defined.
  166. See policy :policy:`CMP0086`.
  167. * The :module:`UseSWIG` module gained an option to specify
  168. ``SWIG`` source file extensions.
  169. .. _`fontconfig`: https://www.freedesktop.org/wiki/Software/fontconfig/
  170. .. _`libinput`: https://www.freedesktop.org/wiki/Software/libinput/
  171. Generator Expressions
  172. ---------------------
  173. * The ``$<Fortran_COMPILER_ID:...>`` and ``$<Fortran_COMPILER_VERSION:...>``
  174. :manual:`generator expressions <cmake-generator-expressions(7)>` were added.
  175. * The ``$<IN_LIST:...>`` generator expression now correctly handles an
  176. empty argument. See :policy:`CMP0085` for details.
  177. Autogen
  178. -------
  179. * The :prop_tgt:`AUTOMOC_EXECUTABLE`, :prop_tgt:`AUTORCC_EXECUTABLE`, and
  180. :prop_tgt:`AUTOUIC_EXECUTABLE` target properties were added. They all
  181. take a path to an executable and force automoc/autorcc/autouic to use
  182. this executable.
  183. Setting these will also prevent the configure time testing for these
  184. executables. This is mainly useful when you build these tools yourself.
  185. * The new variables :variable:`CMAKE_GLOBAL_AUTOGEN_TARGET`,
  186. :variable:`CMAKE_GLOBAL_AUTOGEN_TARGET_NAME`,
  187. :variable:`CMAKE_GLOBAL_AUTORCC_TARGET` and
  188. :variable:`CMAKE_GLOBAL_AUTORCC_TARGET_NAME` control the generation
  189. of global ``autogen`` and ``autorcc`` targets.
  190. * A new :variable:`CMAKE_AUTOGEN_ORIGIN_DEPENDS` variable and
  191. :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS` target property may be set to enable or
  192. disable forwarding of the origin target dependencies to the corresponding
  193. ``_autogen`` target.
  194. CTest
  195. -----
  196. * :manual:`ctest(1)` gained a ``--show-only=json-v1`` option to show the
  197. list of tests in a machine-readable JSON format.
  198. See the :ref:`Show as JSON Object Model` section of the manual.
  199. * The :command:`ctest_submit` command learned a new ``Done`` part that can be used
  200. to inform CDash that a build is complete and that no more parts will be uploaded.
  201. * CTest learned to accept the dashboard server submission URL from a single
  202. variable. See the ``SubmitURL`` setting in :manual:`ctest(1)`,
  203. the :variable:`CTEST_SUBMIT_URL` variable, and the ``SUBMIT_URL``
  204. argument of the :command:`ctest_submit` command.
  205. Deprecated and Removed Features
  206. ===============================
  207. * An explicit deprecation diagnostic was added for policies ``CMP0064``
  208. and ``CMP0065`` (``CMP0063`` and below were already deprecated).
  209. The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
  210. of all policies are deprecated and that projects should port to the
  211. NEW behaviors.
  212. * The :generator:`Xcode` generator deprecated support for Xcode
  213. versions prior to Xcode 5. Support for those will be dropped in a
  214. future version of CMake.
  215. * The :module:`FindQt` module is no longer used by the :command:`find_package`
  216. command as a find module. This allows the Qt Project upstream to optionally
  217. provide its own ``QtConfig.cmake`` package configuration file and have
  218. applications use it via ``find_package(Qt)`` rather than
  219. ``find_package(Qt CONFIG)``. See policy :policy:`CMP0084`.
  220. * Support for running CMake on Windows XP and Windows Vista has been dropped.
  221. The precompiled Windows binaries provided on ``cmake.org`` now require
  222. Windows 7 or higher.
  223. * CTest no longer supports submissions via ``ftp``, ``scp``, ``cp``, and
  224. ``xmlrpc``. CDash is the only maintained testing dashboard for CTest,
  225. and it only supports submissions over ``http`` and ``https``.
  226. Other Changes
  227. =============
  228. * Object library linking has been fixed to propagate private link libraries
  229. of object libraries to consuming targets.
  230. * Install rules under :command:`add_subdirectory` now interleave with those in
  231. the calling directory. See policy :policy:`CMP0082` for details.
  232. * CMake now imposes a maximum recursion limit to prevent a stack overflow on
  233. scripts that recurse infinitely. The limit can be adjusted at runtime with
  234. :variable:`CMAKE_MAXIMUM_RECURSION_DEPTH`.
  235. * When using cppcheck via the :variable:`CMAKE_<LANG>_CPPCHECK` variable
  236. or :prop_tgt:`<LANG>_CPPCHECK` property, the build will now fail if
  237. ``cppcheck`` returns non-zero as configured by its command-line options.
  238. * Required link options to manage Position Independent Executable are now
  239. added when :prop_tgt:`POSITION_INDEPENDENT_CODE` is set. The project is
  240. responsible for using the :module:`CheckPIESupported` module to check for
  241. ``PIE`` support to ensure that the :prop_tgt:`POSITION_INDEPENDENT_CODE`
  242. target property will be honored at link time for executables. This behavior
  243. is controlled by policy :policy:`CMP0083`.
  244. * :ref:`Visual Studio Generators` for VS 2010 and above learned
  245. to support the ``VS_DEBUGGER_*`` properties on targets created
  246. via :command:`add_custom_target`.
  247. * The :module:`CPack` module no longer defaults to the ``paxr`` value in the
  248. :variable:`CPACK_DEBIAN_ARCHIVE_TYPE` variable, because ``dpkg`` has
  249. never supported the PAX tar format. The ``paxr`` value will be mapped
  250. to ``gnutar`` and a deprecation message emitted.