3.1.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. CMake 3.1 Release Notes
  2. ***********************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.0 include the following.
  6. Documentation Changes
  7. =====================
  8. * A new :manual:`cmake-compile-features(7)` manual was added.
  9. New Features
  10. ============
  11. Generators
  12. ----------
  13. * The :generator:`Visual Studio 14 2015` generator was added.
  14. Windows Phone and Windows Store
  15. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  16. * Generators for Visual Studio 11 (2012) and above learned to generate
  17. projects for Windows Phone and Windows Store. One may set the
  18. :variable:`CMAKE_SYSTEM_NAME` variable to ``WindowsPhone``
  19. or ``WindowsStore`` on the :manual:`cmake(1)` command-line
  20. or in a :variable:`CMAKE_TOOLCHAIN_FILE` to activate these platforms.
  21. Also set :variable:`CMAKE_SYSTEM_VERSION` to ``8.0`` or ``8.1`` to
  22. specify the version of Windows to be targeted.
  23. NVIDIA Nsight Tegra
  24. ^^^^^^^^^^^^^^^^^^^
  25. * Generators for Visual Studio 10 (2010) and above learned to generate
  26. projects for NVIDIA Nsight Tegra Visual Studio Edition. One may set
  27. the :variable:`CMAKE_SYSTEM_NAME` variable to ``Android`` on the
  28. :manual:`cmake(1)` command-line or in a :variable:`CMAKE_TOOLCHAIN_FILE`
  29. to activate this platform.
  30. Syntax
  31. ------
  32. * The :manual:`cmake-language(7)` syntax for :ref:`Variable References` and
  33. :ref:`Escape Sequences` was simplified in order to allow a much faster
  34. implementation. See policy :policy:`CMP0053`.
  35. * The :command:`if` command no longer automatically dereferences
  36. variables named in quoted or bracket arguments. See policy
  37. :policy:`CMP0054`.
  38. Commands
  39. --------
  40. * The :command:`add_custom_command` command learned to interpret
  41. :manual:`cmake-generator-expressions(7)` in arguments to ``DEPENDS``.
  42. * The :command:`export(PACKAGE)` command learned to check the
  43. :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable to skip
  44. exporting the package.
  45. * The :command:`file(STRINGS)` command gained a new ``ENCODING``
  46. option to enable extraction of ``UTF-8`` strings.
  47. * The :command:`find_package` command learned to check the
  48. :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY` and
  49. :variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY`
  50. variables to skip searching the package registries.
  51. * The :command:`get_property` command learned a new ``INSTALL`` scope
  52. for properties.
  53. * The :command:`install` command learned a ``MESSAGE_NEVER`` option
  54. to avoid output during installation.
  55. * The :command:`set_property` command learned a new ``INSTALL`` scope
  56. for properties.
  57. * The :command:`string` command learned a new ``GENEX_STRIP`` subcommand
  58. which removes
  59. :manual:`generator expression <cmake-generator-expressions(7)>`.
  60. * The :command:`string` command learned a new ``UUID`` subcommand
  61. to generate a univerally unique identifier.
  62. * New :command:`target_compile_features` command allows populating the
  63. :prop_tgt:`COMPILE_FEATURES` target property, just like any other
  64. build variable.
  65. * The :command:`target_sources` command was added to add to the
  66. :prop_tgt:`SOURCES` target property.
  67. Variables
  68. ---------
  69. * The Visual Studio generators for versions 8 (2005) and above
  70. learned to read the target platform name from a new
  71. :variable:`CMAKE_GENERATOR_PLATFORM` variable when it is
  72. not specified as part of the generator name. The platform
  73. name may be specified on the :manual:`cmake(1)` command line
  74. with the ``-A`` option, e.g. ``-G "Visual Studio 12 2013" -A x64``.
  75. * The :variable:`CMAKE_GENERATOR_TOOLSET` variable may now be
  76. initialized in a toolchain file specified by the
  77. :variable:`CMAKE_TOOLCHAIN_FILE` variable. This is useful
  78. when cross-compiling with the Xcode or Visual Studio
  79. generators.
  80. * The :variable:`CMAKE_INSTALL_MESSAGE` variable was introduced to
  81. optionally reduce output installation.
  82. Properties
  83. ----------
  84. * New :prop_tgt:`CXX_STANDARD` and :prop_tgt:`CXX_EXTENSIONS` target
  85. properties may specify values which CMake uses to compute required
  86. compile options such as ``-std=c++11`` or ``-std=gnu++11``. The
  87. :variable:`CMAKE_CXX_STANDARD` and :variable:`CMAKE_CXX_EXTENSIONS`
  88. variables may be set to initialize the target properties.
  89. * New :prop_tgt:`C_STANDARD` and :prop_tgt:`C_EXTENSIONS` target
  90. properties may specify values which CMake uses to compute required
  91. compile options such as ``-std=c11`` or ``-std=gnu11``. The
  92. :variable:`CMAKE_C_STANDARD` and :variable:`CMAKE_C_EXTENSIONS`
  93. variables may be set to initialize the target properties.
  94. * New :prop_tgt:`COMPILE_FEATURES` target property may contain a list
  95. of features required to compile a target. CMake uses this
  96. information to ensure that the compiler in use is capable of building
  97. the target, and to add any necessary compile flags to support language
  98. features.
  99. * New :prop_tgt:`COMPILE_PDB_NAME` and
  100. :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` target properties
  101. were introduced to specify the MSVC compiler program database
  102. file location (``cl /Fd``). This complements the existing
  103. :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
  104. target properties that specify the linker program database
  105. file location (``link /pdb``).
  106. * The :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property now supports
  107. a ``$<LINK_ONLY:...>``
  108. :manual:`generator expression <cmake-generator-expressions(7)>`.
  109. * A new :prop_tgt:`INTERFACE_SOURCES` target property was introduced. This is
  110. consumed by dependent targets, which compile and link the listed sources.
  111. * The :prop_tgt:`SOURCES` target property now contains
  112. :manual:`generator expression <cmake-generator-expressions(7)>`
  113. such as ``TARGET_OBJECTS`` when read at configure time, if
  114. policy :policy:`CMP0051` is ``NEW``.
  115. * The :prop_tgt:`SOURCES` target property now generally supports
  116. :manual:`generator expression <cmake-generator-expressions(7)>`. The
  117. generator expressions may be used in the :command:`add_library` and
  118. :command:`add_executable` commands.
  119. * It is now possible to write and append to the :prop_tgt:`SOURCES` target
  120. property. The :variable:`CMAKE_DEBUG_TARGET_PROPERTIES` variable may be
  121. used to trace the origin of sources.
  122. * A :prop_sf:`VS_DEPLOYMENT_CONTENT` source file property was added
  123. to tell the Visual Studio generators to mark content for deployment
  124. in Windows Phone and Windows Store projects.
  125. * A :prop_sf:`VS_DEPLOYMENT_LOCATION` source file property was added
  126. to tell the Visual Studio generators the relative location of content
  127. marked for deployment in Windows Phone and Windows Store projects.
  128. * The :prop_tgt:`VS_WINRT_COMPONENT` target property was created to
  129. tell Visual Studio generators to compile a shared library as a
  130. Windows Runtime (WinRT) component.
  131. * The :generator:`Xcode` generator learned to check source
  132. file properties :prop_sf:`XCODE_EXPLICIT_FILE_TYPE` and
  133. :prop_sf:`XCODE_LAST_KNOWN_FILE_TYPE` for a custom Xcode
  134. file reference type.
  135. Modules
  136. -------
  137. * The :module:`BundleUtilities` module learned to resolve and replace
  138. ``@rpath`` placeholders on OS X to correctly bundle applications
  139. using them.
  140. * The :module:`CMakePackageConfigHelpers` module
  141. :command:`configure_package_config_file` command learned a new
  142. ``INSTALL_PREFIX`` option to generate package configuration files
  143. meant for a prefix other than :variable:`CMAKE_INSTALL_PREFIX`.
  144. * The :module:`CheckFortranSourceCompiles` module was added to
  145. provide a ``CHECK_Fortran_SOURCE_COMPILES`` macro.
  146. * The :module:`ExternalData` module learned to tolerate a ``DATA{}``
  147. reference to a missing source file with a warning instead of
  148. rejecting it with an error. This helps developers write new
  149. ``DATA{}`` references to test reference outputs that have not
  150. yet been created.
  151. * The :module:`ExternalProject` module learned to support lzma-compressed
  152. source tarballs with ``.7z``, ``.tar.xz``, and ``.txz`` extensions.
  153. * The :module:`ExternalProject` module ``ExternalProject_Add`` command
  154. learned a new ``BUILD_ALWAYS`` option to cause the external project
  155. build step to run every time the host project is built.
  156. * The :module:`ExternalProject` module ``ExternalProject_Add`` command
  157. learned a new ``EXCLUDE_FROM_ALL`` option to cause the external
  158. project target to have the :prop_tgt:`EXCLUDE_FROM_ALL` target
  159. property set.
  160. * The :module:`ExternalProject` module ``ExternalProject_Add_Step`` command
  161. learned a new ``EXCLUDE_FROM_MAIN`` option to cause the step to not be
  162. a direct dependency of the main external project target.
  163. * The :module:`ExternalProject` module ``ExternalProject_Add`` command
  164. learned a new ``DOWNLOAD_NO_PROGRESS`` option to disable progress
  165. output while downloading the source tarball.
  166. * The :module:`FeatureSummary` module ``feature_summary`` API
  167. learned to accept multiple values for the ``WHAT`` option and
  168. combine them appropriately.
  169. * The :module:`FindCUDA` module learned to support ``fatbin`` and ``cubin``
  170. modules.
  171. * The :module:`FindGTest` module ``gtest_add_tests`` macro learned
  172. a new ``AUTO`` option to automatically read the :prop_tgt:`SOURCES`
  173. target property of the test executable and scan the source files
  174. for tests to be added.
  175. * The :module:`FindGLEW` module now provides imported targets.
  176. * The :module:`FindGLUT` module now provides imported targets.
  177. * The :module:`FindHg` module gained a new ``Hg_WC_INFO`` macro to
  178. help run ``hg`` to extract information about a Mercurial work copy.
  179. * The :module:`FindOpenCL` module was introduced.
  180. * The :module:`FindOpenMP` module learned to support Fortran.
  181. * The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG``
  182. environment variable value as the ``pkg-config`` executable, if set.
  183. * The :module:`FindXercesC` module was introduced.
  184. * The :module:`FindZLIB` module now provides imported targets.
  185. * The :module:`GenerateExportHeader` module ``generate_export_header``
  186. function learned to allow use with :ref:`Object Libraries`.
  187. * The :module:`InstallRequiredSystemLibraries` module gained a new
  188. ``CMAKE_INSTALL_OPENMP_LIBRARIES`` option to install MSVC OpenMP
  189. runtime libraries.
  190. * The :module:`UseSWIG` module learned to detect the module name
  191. from ``.i`` source files if possible to avoid the need to set
  192. the ``SWIG_MODULE_NAME`` source file property explicitly.
  193. * The :module:`WriteCompilerDetectionHeader` module was added to allow
  194. creation of a portable header file for compiler optional feature detection.
  195. Generator Expressions
  196. ---------------------
  197. * New ``COMPILE_FEATURES``
  198. :manual:`generator expression <cmake-generator-expressions(7)>` allows
  199. setting build properties based on available compiler features.
  200. CTest
  201. -----
  202. * The :command:`ctest_coverage` command learned to read variable
  203. ``CTEST_COVERAGE_EXTRA_FLAGS`` to set ``CoverageExtraFlags``.
  204. * The :command:`ctest_coverage` command learned to support
  205. Intel coverage files with the ``codecov`` tool.
  206. * The :command:`ctest_memcheck` command learned to support sanitizer
  207. modes, including ``AddressSanitizer``, ``MemorySanitizer``,
  208. ``ThreadSanitizer``, and ``UndefinedBehaviorSanitizer``.
  209. Options may be set using the new
  210. :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS` variable.
  211. CPack
  212. -----
  213. * :manual:`cpack(1)` gained an ``IFW`` generator to package using
  214. Qt Framework Installer tools. See the :module:`CPackIFW` module.
  215. * :manual:`cpack(1)` gained ``7Z`` and ``TXZ`` generators supporting
  216. lzma-compressed archives.
  217. * The :module:`CPackDeb` module learned a new
  218. :variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the
  219. tarball compression type.
  220. * The :manual:`cpack(1)` ``WiX`` generator learned to support
  221. a :prop_inst:`CPACK_WIX_ACL` installed file property to
  222. specify an Access Control List.
  223. Other
  224. -----
  225. * The :manual:`cmake(1)` ``-E`` option learned a new ``env`` command.
  226. * The :manual:`cmake(1)` ``-E tar`` command learned to support
  227. lzma-compressed files.
  228. * :ref:`Object Libraries` may now have extra sources that do not
  229. compile to object files so long as they would not affect linking
  230. of a normal library (e.g. ``.dat`` is okay but not ``.def``).
  231. * Visual Studio generators for VS 8 and later learned to support
  232. the ``ASM_MASM`` language.
  233. * The Visual Studio generators learned to treat ``.hlsl`` source
  234. files as High Level Shading Language sources (using ``FXCompile``
  235. in ``.vcxproj`` files). Source file properties
  236. :prop_sf:`VS_SHADER_TYPE`, :prop_sf:`VS_SHADER_MODEL`, and
  237. :prop_sf:`VS_SHADER_ENTRYPOINT` were added added to specify the
  238. shader type, model, and entry point name.
  239. New Diagnostics
  240. ===============
  241. * Policy :policy:`CMP0052` introduced to control directories in the
  242. :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of exported targets.
  243. Deprecated and Removed Features
  244. ===============================
  245. * In CMake 3.0 the :command:`target_link_libraries` command
  246. accidentally began allowing unquoted arguments to use
  247. :manual:`generator expressions <cmake-generator-expressions(7)>`
  248. containing a (``;`` separated) list within them. For example::
  249. set(libs B C)
  250. target_link_libraries(A PUBLIC $<BUILD_INTERFACE:${libs}>)
  251. This is equivalent to writing::
  252. target_link_libraries(A PUBLIC $<BUILD_INTERFACE:B C>)
  253. and was never intended to work. It did not work in CMake 2.8.12.
  254. Such generator expressions should be in quoted arguments::
  255. set(libs B C)
  256. target_link_libraries(A PUBLIC "$<BUILD_INTERFACE:${libs}>")
  257. CMake 3.1 again requires the quotes for this to work correctly.
  258. * Prior to CMake 3.1 the Makefile generators did not escape ``#``
  259. correctly inside make variable assignments used in generated
  260. makefiles, causing them to be treated as comments. This made
  261. code like::
  262. add_compile_options(-Wno-#pragma-messages)
  263. not work in Makefile generators, but work in other generators.
  264. Now it is escaped correctly, making the behavior consistent
  265. across generators. However, some projects may have tried to
  266. workaround the original bug with code like::
  267. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-\\#pragma-messages")
  268. This added the needed escape for Makefile generators but also
  269. caused other generators to pass ``-Wno-\#pragma-messages`` to
  270. the shell, which would work only in POSIX shells.
  271. Unfortunately the escaping fix could not be made in a compatible
  272. way so this platform- and generator-specific workaround no
  273. longer works. Project code may test the :variable:`CMAKE_VERSION`
  274. variable value to make the workaround version-specific too.
  275. * Callbacks established by the :command:`variable_watch` command will no
  276. longer receive the ``ALLOWED_UNKNOWN_READ_ACCESS`` access type when
  277. the undocumented ``CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS`` variable is
  278. set. Uninitialized variable accesses will always be reported as
  279. ``UNKNOWN_READ_ACCESS``.
  280. * The :module:`CMakeDetermineVSServicePack` module now warns that
  281. it is deprecated and should not longer be used. Use the
  282. :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead.
  283. * The :module:`FindITK` module has been removed altogether.
  284. It was a thin-wrapper around ``find_package(ITK ... NO_MODULE)``.
  285. This produces much clearer error messages when ITK is not found.
  286. * The :module:`FindVTK` module has been removed altogether.
  287. It was a thin-wrapper around ``find_package(VTK ... NO_MODULE)``.
  288. This produces much clearer error messages when VTK is not found.
  289. The module also provided compatibility support for finding VTK 4.0.
  290. This capability has been dropped.
  291. Other Changes
  292. =============
  293. * The :manual:`cmake-gui(1)` learned to capture output from child
  294. processes started by the :command:`execute_process` command
  295. and display it in the output window.
  296. * The :manual:`cmake-language(7)` internal implementation of generator
  297. expression and list expansion parsers have been optimized and shows
  298. non-trivial speedup on large projects.
  299. * The Makefile generators learned to use response files with GNU tools
  300. on Windows to pass library directories and names to the linker.
  301. * When generating linker command-lines, CMake now avoids repeating
  302. items corresponding to SHARED library targets.
  303. * Support for the Open Watcom compiler has been overhauled.
  304. The :variable:`CMAKE_<LANG>_COMPILER_ID` is now ``OpenWatcom``,
  305. and the :variable:`CMAKE_<LANG>_COMPILER_VERSION` now uses
  306. the Open Watcom external version numbering. The external
  307. version numbers are lower than the internal version number
  308. by 11.
  309. * The ``cmake-mode.el`` major Emacs editing mode no longer
  310. treats ``_`` as part of words, making it more consistent
  311. with other major modes.