3.14.rst 18 KB

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