3.0.rst 19 KB

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