3.1.0.rst 14 KB

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