3.0.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. CMake 3.0 Release Notes
  2. ***********************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 2.8.12 include the following.
  6. Documentation Changes
  7. =====================
  8. * The CMake documentation has been converted to reStructuredText and
  9. now transforms via Sphinx (`<https://www.sphinx-doc.org>`__) into man and
  10. html pages. This allows the documentation to be properly indexed
  11. and to contain cross-references.
  12. Conversion from the old internal documentation format was done by
  13. an automatic process so some documents may still contain artifacts.
  14. They will be updated incrementally over time.
  15. A basic reStructuredText processor has been implemented to support
  16. ``cmake --help-command`` and similar command-line options.
  17. * New manuals were added:
  18. - :manual:`cmake-buildsystem(7)`
  19. - :manual:`cmake-commands(7)`, replacing ``cmakecommands(1)``
  20. and ``cmakecompat(1)``
  21. - :manual:`cmake-developer(7)`
  22. - :manual:`cmake-generator-expressions(7)`
  23. - :manual:`cmake-generators(7)`
  24. - :manual:`cmake-language(7)`
  25. - :manual:`cmake-modules(7)`, replacing ``cmakemodules(1)``
  26. - :manual:`cmake-packages(7)`
  27. - :manual:`cmake-policies(7)`, replacing ``cmakepolicies(1)``
  28. - :manual:`cmake-properties(7)`, replacing ``cmakeprops(1)``
  29. - :manual:`cmake-qt(7)`
  30. - :manual:`cmake-toolchains(7)`
  31. - :manual:`cmake-variables(7)`, replacing ``cmakevars(1)``
  32. * Release notes for CMake 3.0.0 and above will now be included with
  33. the html documentation.
  34. New Features
  35. ============
  36. Syntax
  37. ------
  38. * The CMake language has been extended with
  39. :ref:`Bracket Argument` and :ref:`Bracket Comment`
  40. syntax inspired by Lua long brackets:
  41. .. code-block:: cmake
  42. set(x [===[bracket argument]===] #[[bracket comment]])
  43. Content between equal-length open- and close-brackets is taken
  44. literally with no variable replacements.
  45. .. warning::
  46. This syntax change could not be made in a fully compatible
  47. way. No policy is possible because syntax parsing occurs before
  48. any chance to set a policy. Existing code using an unquoted
  49. argument that starts with an open bracket will be interpreted
  50. differently without any diagnostic. Fortunately the syntax is
  51. obscure enough that this problem is unlikely in practice.
  52. Generators
  53. ----------
  54. * A new :generator:`CodeLite` extra generator is available
  55. for use with the Makefile or Ninja generators.
  56. * A new :generator:`Kate` extra generator is available
  57. for use with the Makefile or Ninja generators.
  58. * The :generator:`Ninja` generator learned to use ``ninja`` job pools
  59. when specified by a new :prop_gbl:`JOB_POOLS` global property.
  60. Commands
  61. --------
  62. * The :command:`add_library` command learned a new ``INTERFACE``
  63. library type. Interface libraries have no build rules but may
  64. have properties defining
  65. :manual:`usage requirements <cmake-buildsystem(7)>`
  66. and may be installed, exported, and imported. This is useful to
  67. create header-only libraries that have concrete link dependencies
  68. on other libraries.
  69. * The :command:`export()` command learned a new ``EXPORT`` mode that
  70. retrieves the list of targets to export from an export set configured
  71. by the :command:`install(TARGETS)` command ``EXPORT`` option. This
  72. makes it easy to export from the build tree the same targets that
  73. are exported from the install tree.
  74. * The :command:`export` command learned to work with multiple dependent
  75. export sets, thus allowing multiple packages to be built and exported
  76. from a single tree. The feature requires CMake to wait until the
  77. generation step to write the output file. This means one should not
  78. :command:`include` the generated targets file later during project
  79. configuration because it will not be available.
  80. Use :ref:`Alias Targets` instead. See policy :policy:`CMP0024`.
  81. * The :command:`install(FILES)` command learned to support
  82. :manual:`generator expressions <cmake-generator-expressions(7)>`
  83. in the list of files.
  84. * The :command:`project` command learned to set some version variables
  85. to values specified by the new ``VERSION`` option or to empty strings.
  86. See policy :policy:`CMP0048`.
  87. * The :command:`string` command learned a new ``CONCAT`` mode.
  88. It is particularly useful in combination with the new
  89. :ref:`Bracket Argument` syntax.
  90. * The :command:`unset` command learned a ``PARENT_SCOPE`` option
  91. matching that of the :command:`set` command.
  92. * The :command:`include_external_msproject` command learned
  93. to handle non-C++ projects like ``.vbproj`` or ``.csproj``.
  94. * The :command:`ctest_update` command learned to update work trees
  95. managed by the Perforce (p4) version control tool.
  96. * The :command:`message` command learned a ``DEPRECATION`` mode. Such
  97. messages are not issued by default, but may be issued as a warning if
  98. :variable:`CMAKE_WARN_DEPRECATED` is enabled, or as an error if
  99. :variable:`CMAKE_ERROR_DEPRECATED` is enabled.
  100. * The :command:`target_link_libraries` command now allows repeated use of
  101. the ``LINK_PUBLIC`` and ``LINK_PRIVATE`` keywords.
  102. Variables
  103. ---------
  104. * Variable :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` has been
  105. introduced to tell CMake not to add the value of
  106. :variable:`CMAKE_INSTALL_PREFIX` to the
  107. :variable:`CMAKE_SYSTEM_PREFIX_PATH` variable by default.
  108. This is useful when building a project that installs some
  109. of its own dependencies to avoid finding files it is about
  110. to replace.
  111. * Variable :variable:`CMAKE_STAGING_PREFIX` was introduced for use
  112. when cross-compiling to specify an installation prefix on the
  113. host system that differs from a :variable:`CMAKE_INSTALL_PREFIX`
  114. value meant for the target system.
  115. * Variable :variable:`CMAKE_SYSROOT` was introduced to specify the
  116. toolchain SDK installation prefix, typically for cross-compiling.
  117. This is used to pass a ``--sysroot`` option to the compiler and
  118. as a prefix searched by ``find_*`` commands.
  119. * Variable :variable:`CMAKE_<LANG>_COMPILER_TARGET` was introduced
  120. for use when cross-compiling to specify the target platform in the
  121. :ref:`toolchain file <Cross Compiling Toolchain>` specified by the
  122. :variable:`CMAKE_TOOLCHAIN_FILE` variable.
  123. This is used to pass an option such as ``--target=<triple>`` to some
  124. cross-compiling compiler drivers.
  125. * Variable :variable:`CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>` has been
  126. introduced to optionally initialize the
  127. :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property.
  128. Properties
  129. ----------
  130. * The :prop_dir:`ADDITIONAL_MAKE_CLEAN_FILES` directory property
  131. learned to support
  132. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  133. * A new directory property :prop_dir:`CMAKE_CONFIGURE_DEPENDS`
  134. was introduced to allow projects to specify additional
  135. files on which the configuration process depends. CMake will
  136. re-run at build time when one of these files is modified.
  137. Previously this was only possible to achieve by specifying
  138. such files as the input to a :command:`configure_file` command.
  139. * A new :ref:`Qt AUTORCC` feature replaces the need to
  140. invoke ``qt4_add_resources()`` by allowing ``.qrc`` files to
  141. be listed as target sources.
  142. * A new :ref:`Qt AUTOUIC` feature replaces the need to
  143. invoke ``qt4_wrap_ui()``.
  144. * Test properties learned to support
  145. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  146. This is useful to specify per-configuration values for test
  147. properties like :prop_test:`REQUIRED_FILES` and
  148. :prop_test:`WORKING_DIRECTORY`.
  149. * A new :prop_test:`SKIP_RETURN_CODE` test property was introduced
  150. to tell :manual:`ctest(1)` to treat a particular test return code as
  151. if the test were not run. This is useful for test drivers to report
  152. that certain test requirements were not available.
  153. * New types of :ref:`Compatible Interface Properties` were introduced,
  154. namely the :prop_tgt:`COMPATIBLE_INTERFACE_NUMBER_MAX` and
  155. :prop_tgt:`COMPATIBLE_INTERFACE_NUMBER_MIN` for calculating numeric
  156. maximum and minimum values respectively.
  157. Modules
  158. -------
  159. * The :module:`CheckTypeSize` module ``check_type_size()`` command and
  160. the :module:`CheckStructHasMember` module ``check_struct_has_member()``
  161. command learned a new ``LANGUAGE`` option to optionally check C++ types.
  162. * The :module:`ExternalData` module learned to work with no
  163. URL templates if a local store is available.
  164. * The :module:`ExternalProject` function ``ExternalProject_Add``
  165. learned a new ``GIT_SUBMODULES`` option to specify a subset
  166. of available submodules to checkout.
  167. * A new :module:`FindBacktrace` module has been added to support
  168. :command:`find_package(Backtrace)` calls.
  169. * A new :module:`FindLua` module has been added to support
  170. :command:`find_package(Lua)` calls.
  171. * The :module:`FindBoost` module learned a new ``Boost_NAMESPACE``
  172. option to change the ``boost`` prefix on library names.
  173. * The :module:`FindBoost` module learned to control search
  174. for libraries with the ``g`` tag (for MS debug runtime) with
  175. a new ``Boost_USE_DEBUG_RUNTIME`` option. It is ``ON`` by
  176. default to preserve existing behavior.
  177. * The :module:`FindJava` and :module:`FindJNI` modules learned
  178. to use a ``JAVA_HOME`` CMake variable or environment variable,
  179. and then try ``/usr/libexec/java_home`` on OS X.
  180. * The :module:`UseJava` module ``add_jar`` function learned a new
  181. ``MANIFEST`` option to pass the ``-m`` option to ``jar``.
  182. * A new :module:`CMakeFindDependencyMacro` module was introduced with
  183. a ``find_dependency`` macro to find transitive dependencies in
  184. a :manual:`package configuration file <cmake-packages(7)>`. Such
  185. dependencies are omitted by the listing of the :module:`FeatureSummary`
  186. module.
  187. * The :module:`FindQt4` module learned to create :ref:`Imported Targets`
  188. for Qt executables. This helps disambiguate when using multiple
  189. :manual:`Qt versions <cmake-qt(7)>` in the same buildsystem.
  190. * The :module:`FindRuby` module learned to search for Ruby 2.0 and 2.1.
  191. Generator Expressions
  192. ---------------------
  193. * New ``$<PLATFORM_ID>`` and ``$<PLATFORM_ID:...>``
  194. :manual:`generator expressions <cmake-generator-expressions(7)>`
  195. have been added.
  196. * The ``$<CONFIG>``
  197. :manual:`generator expression <cmake-generator-expressions(7)>` now has
  198. a variant which takes no argument. This is equivalent to the
  199. ``$<CONFIGURATION>`` expression.
  200. * New ``$<UPPER_CASE:...>`` and ``$<LOWER_CASE:...>``
  201. :manual:`generator expressions <cmake-generator-expressions(7)>`
  202. generator expressions have been added.
  203. * A new ``$<MAKE_C_IDENTIFIER:...>``
  204. :manual:`generator expression <cmake-generator-expressions(7)>` has
  205. been added.
  206. Other
  207. -----
  208. * The :manual:`cmake(1)` ``-E`` option learned a new ``sleep`` command.
  209. * The :manual:`ccmake(1)` dialog learned to honor the
  210. :prop_cache:`STRINGS` cache entry property to cycle through
  211. the enumerated list of possible values.
  212. * The :manual:`cmake-gui(1)` dialog learned to remember window
  213. settings between sessions.
  214. * The :manual:`cmake-gui(1)` dialog learned to remember the type
  215. of a cache entry for completion in the ``Add Entry`` dialog.
  216. New Diagnostics
  217. ===============
  218. * Directories named in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`
  219. target property of imported targets linked conditionally by a
  220. :manual:`generator expression <cmake-generator-expressions(7)>`
  221. were not checked for existence. Now they are checked.
  222. See policy :policy:`CMP0027`.
  223. * Build target names must now match a validity pattern and may no longer
  224. conflict with CMake-defined targets. See policy :policy:`CMP0037`.
  225. * Build targets that specify themselves as a link dependency were
  226. silently accepted but are now diagnosed. See :policy:`CMP0038`.
  227. * The :command:`target_link_libraries` command used to silently ignore
  228. calls specifying as their first argument build targets created by
  229. :command:`add_custom_target` but now diagnoses this mistake.
  230. See policy :policy:`CMP0039`.
  231. * The :command:`add_custom_command` command used to silently ignore
  232. calls specifying the ``TARGET`` option with a non-existent target
  233. but now diagnoses this mistake. See policy :policy:`CMP0040`.
  234. * Relative paths in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`
  235. target property used to be silently accepted if they contained a
  236. :manual:`generator expression <cmake-generator-expressions(7)>`
  237. but are now rejected. See policy :policy:`CMP0041`.
  238. * The :command:`get_target_property` command learned to reject calls
  239. specifying a non-existent target. See policy :policy:`CMP0045`.
  240. * The :command:`add_dependencies` command learned to reject calls
  241. specifying a dependency on a non-existent target.
  242. See policy :policy:`CMP0046`.
  243. * Link dependency analysis learned to assume names containing ``::``
  244. refer to :ref:`Alias Targets` or :ref:`Imported Targets`. It will
  245. now produce an error if such a linked target is missing. Previously
  246. in this case CMake generated a link line that failed at build time.
  247. See policy :policy:`CMP0028`.
  248. * When the :command:`project` or :command:`enable_language` commands
  249. initialize support for a language, it is now an error if the full
  250. path to the compiler cannot be found and stored in the corresponding
  251. :variable:`CMAKE_<LANG>_COMPILER` variable. This produces nicer error
  252. messages up front and stops processing when no working compiler
  253. is known to be available.
  254. * Target sources specified with the :command:`add_library` or
  255. :command:`add_executable` command learned to reject items which
  256. require an undocumented extra layer of variable expansion.
  257. See policy :policy:`CMP0049`.
  258. * Use of :command:`add_custom_command` undocumented ``SOURCE``
  259. signatures now results in an error. See policy :policy:`CMP0050`.
  260. Deprecated and Removed Features
  261. ===============================
  262. * Compatibility options supporting code written for CMake versions
  263. prior to 2.4 have been removed.
  264. * Several long-outdated commands that should no longer be called
  265. have been disallowed in new code by policies:
  266. - Policy :policy:`CMP0029` disallows :command:`subdir_depends`
  267. - Policy :policy:`CMP0030` disallows :command:`use_mangled_mesa`
  268. - Policy :policy:`CMP0031` disallows :command:`load_command`
  269. - Policy :policy:`CMP0032` disallows :command:`output_required_files`
  270. - Policy :policy:`CMP0033` disallows :command:`export_library_dependencies`
  271. - Policy :policy:`CMP0034` disallows :command:`utility_source`
  272. - Policy :policy:`CMP0035` disallows :command:`variable_requires`
  273. - Policy :policy:`CMP0036` disallows :command:`build_name`
  274. * The :manual:`cmake(1)` ``-i`` wizard mode has been removed.
  275. Instead use an interactive dialog such as :manual:`ccmake(1)`
  276. or use the ``-D`` option to set cache values from the command line.
  277. * The builtin documentation formatters that supported command-line
  278. options such as ``--help-man`` and ``--help-html`` have been removed
  279. in favor of the above-mentioned new documentation system. These and
  280. other command-line options that used to generate man- and
  281. html- formatted pages no longer work. The :manual:`cmake(1)`
  282. ``--help-custom-modules`` option now produces a warning at runtime
  283. and generates a minimal document that reports the limitation.
  284. * The :prop_dir:`COMPILE_DEFINITIONS_<CONFIG>` directory properties and the
  285. :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target properties have been
  286. deprecated. Instead set the corresponding :prop_dir:`COMPILE_DEFINITIONS`
  287. directory property or :prop_tgt:`COMPILE_DEFINITIONS` target property and
  288. use :manual:`generator expressions <cmake-generator-expressions(7)>` like
  289. ``$<CONFIG:...>`` to specify per-configuration definitions.
  290. See policy :policy:`CMP0043`.
  291. * The :prop_tgt:`LOCATION` target property should no longer be read from
  292. non-IMPORTED targets. It does not make sense in multi-configuration
  293. generators since the build configuration is not known while configuring
  294. the project. It has been superseded by the ``$<TARGET_FILE>`` generator
  295. expression. See policy :policy:`CMP0026`.
  296. * The :prop_tgt:`COMPILE_FLAGS` target property is now documented
  297. as deprecated, though no warning is issued. Use the
  298. :prop_tgt:`COMPILE_OPTIONS` target property or the
  299. :command:`target_compile_options` command instead.
  300. * The :module:`GenerateExportHeader` module ``add_compiler_export_flags``
  301. command is now deprecated. It has been superseded by the
  302. :prop_tgt:`<LANG>_VISIBILITY_PRESET` and
  303. :prop_tgt:`VISIBILITY_INLINES_HIDDEN` target properties.
  304. Other Changes
  305. =============
  306. * The version scheme was changed to use only two components for
  307. the feature level instead of three. The third component will
  308. now be used for bug-fix releases or the date of development versions.
  309. See the :variable:`CMAKE_VERSION` variable documentation for details.
  310. * The default install locations of CMake itself on Windows and
  311. OS X no longer contain the CMake version number. This allows
  312. for easy replacement without re-generating local build trees
  313. manually.
  314. * Generators for Visual Studio 10 (2010) and later were renamed to
  315. include the product year like generators for older VS versions:
  316. - ``Visual Studio 10`` -> :generator:`Visual Studio 10 2010`
  317. - ``Visual Studio 11`` -> :generator:`Visual Studio 11 2012`
  318. - ``Visual Studio 12`` -> :generator:`Visual Studio 12 2013`
  319. This clarifies which generator goes with each Visual Studio
  320. version. The old names are recognized for compatibility.
  321. * The :variable:`CMAKE_<LANG>_COMPILER_ID` value for Apple-provided
  322. Clang is now ``AppleClang``. It must be distinct from upstream
  323. Clang because the version numbers differ.
  324. See policy :policy:`CMP0025`.
  325. * The :variable:`CMAKE_<LANG>_COMPILER_ID` value for ``qcc`` on QNX
  326. is now ``QCC``. It must be distinct from ``GNU`` because the
  327. command-line options differ. See policy :policy:`CMP0047`.
  328. * On 64-bit OS X the :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` value
  329. is now correctly detected as ``x86_64`` instead of ``i386``.
  330. * On OS X, CMake learned to enable behavior specified by the
  331. :prop_tgt:`MACOSX_RPATH` target property by default. This activates
  332. use of ``@rpath`` for runtime shared library searches.
  333. See policy :policy:`CMP0042`.
  334. * The :command:`build_command` command now returns a :manual:`cmake(1)`
  335. ``--build`` command line instead of a direct invocation of the native
  336. build tool. When using ``Visual Studio`` generators, CMake and CTest
  337. no longer require :variable:`CMAKE_MAKE_PROGRAM` to be located up front.
  338. Selection of the proper msbuild or devenv tool is now performed as
  339. late as possible when the solution (``.sln``) file is available so
  340. it can depend on project content.
  341. * The :manual:`cmake(1)` ``--build`` command now shares its own stdout
  342. and stderr pipes with the native build tool by default.
  343. The ``--use-stderr`` option that once activated this is now ignored.
  344. * The ``$<C_COMPILER_ID:...>`` and ``$<CXX_COMPILER_ID:...>``
  345. :manual:`generator expressions <cmake-generator-expressions(7)>`
  346. used to perform case-insensitive comparison but have now been
  347. corrected to perform case-sensitive comparison.
  348. See policy :policy:`CMP0044`.
  349. * The builtin ``edit_cache`` target will no longer select
  350. :manual:`ccmake(1)` by default when no interactive terminal will
  351. be available (e.g. with :generator:`Ninja` or an IDE generator).
  352. Instead :manual:`cmake-gui(1)` will be preferred if available.
  353. * The :module:`ExternalProject` download step learned to
  354. re-attempt download in certain cases to be more robust to
  355. temporary network failure.
  356. * The :module:`FeatureSummary` no longer lists transitive
  357. dependencies since they were not directly requested by the
  358. current project.
  359. * The ``cmake-mode.el`` major Emacs editing mode has been cleaned
  360. up and enhanced in several ways.
  361. * Include directories specified in the
  362. :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of :ref:`Imported Targets`
  363. are treated as ``SYSTEM`` includes by default when handled as
  364. :ref:`usage requirements <Include Directories and Usage Requirements>`.