3.14.rst 16 KB

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