3.12.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. CMake 3.12 Release Notes
  2. ************************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.11 include the following.
  6. New Features
  7. ============
  8. Generators
  9. ----------
  10. * The :ref:`Visual Studio Generators` for VS 2017 learned to support a
  11. ``version=14.##`` option in the :variable:`CMAKE_GENERATOR_TOOLSET`
  12. value (e.g. via the :manual:`cmake(1)` ``-T`` option) to specify a
  13. toolset version number.
  14. Command-Line
  15. ------------
  16. * The :manual:`cmake(1)` :ref:`Build Tool Mode` (``cmake --build``) gained
  17. ``--parallel [<jobs>]`` and ``-j [<jobs>]`` options to specify a parallel
  18. build level. They map to corresponding options of the native build tool.
  19. Commands
  20. --------
  21. * The :command:`add_compile_definitions` command was added to set preprocessor
  22. definitions at directory level. This supersedes :command:`add_definitions`.
  23. * The :command:`cmake_minimum_required` and :command:`cmake_policy(VERSION)`
  24. commands now accept a version range using the form ``<min>[...<max>]``.
  25. The ``<min>`` version is required but policies are set based on the
  26. ``<max>`` version. This allows projects to specify a range of versions
  27. for which they have been updated and avoid explicit policy settings.
  28. * The :command:`file(GLOB)` and :command:`file(GLOB_RECURSE)` commands
  29. learned a new flag ``CONFIGURE_DEPENDS`` which enables expression of
  30. build system dependency on globbed directory's contents.
  31. * The :command:`file(TOUCH)` and :command:`file(TOUCH_NOCREATE)` commands
  32. were added to expose ``TOUCH`` functionality without having to use
  33. CMake's command-line tool mode with :command:`execute_process`.
  34. * The :command:`find_package` command now searches a prefix specified by
  35. a ``PackageName_ROOT`` CMake or environment variable. Package roots are
  36. maintained as a stack so nested calls to all ``find_*`` commands inside
  37. find modules also search the roots as prefixes.
  38. See policy :policy:`CMP0074`.
  39. * The :command:`install` command learned an optional ``NAMELINK_COMPONENT``
  40. parameter, which allows you to change the component for a shared library's
  41. namelink. If none is specified, the value of ``COMPONENT`` is used by
  42. default.
  43. * The :command:`list` command learned a ``JOIN`` sub-command
  44. to concatenate list's elements separated by a glue string.
  45. * The :command:`list` command learned a ``SUBLIST`` sub-command
  46. to get a sublist of the list.
  47. * The :command:`list` command learned a ``TRANSFORM`` sub-command
  48. to apply various string transformation to list's elements.
  49. * The :command:`project` command learned an optional ``HOMEPAGE_URL``
  50. parameter which has the effect of setting variables like
  51. :variable:`PROJECT_HOMEPAGE_URL`, :variable:`<PROJECT-NAME>_HOMEPAGE_URL`
  52. and :variable:`CMAKE_PROJECT_HOMEPAGE_URL`.
  53. * The :command:`string` command learned a ``JOIN`` sub-command
  54. to concatenate input strings separated by a glue string.
  55. * :command:`target_compile_options` and :command:`add_compile_options`
  56. commands gained a ``SHELL:`` prefix to specify a group of related
  57. options using shell-like quoting.
  58. * The :command:`target_link_libraries` command now supports
  59. :ref:`Object Libraries`. Linking to an object library uses its object
  60. files in direct dependents and also propagates usage requirements.
  61. * The :command:`target_link_libraries` command may now be called
  62. to modify targets created outside the current directory.
  63. Variables
  64. ---------
  65. * The :variable:`CMAKE_FOLDER` variable was added to initialize the
  66. :prop_tgt:`FOLDER` property on all targets.
  67. * The :variable:`CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION` variable
  68. was defined to initialize all
  69. :prop_tgt:`DOTNET_TARGET_FRAMEWORK_VERSION` target properties.
  70. * ``CMAKE_PROJECT_VERSION*`` variables have been introduced:
  71. - :variable:`CMAKE_PROJECT_VERSION`
  72. - :variable:`CMAKE_PROJECT_VERSION_MAJOR`
  73. - :variable:`CMAKE_PROJECT_VERSION_MINOR`
  74. - :variable:`CMAKE_PROJECT_VERSION_PATCH`
  75. - :variable:`CMAKE_PROJECT_VERSION_TWEAK`
  76. * The :variable:`CMAKE_SUPPRESS_REGENERATION` variable was extended to
  77. support the :generator:`Ninja` and :ref:`Makefile Generators`.
  78. It is also now documented.
  79. * ``CMAKE_VS_SDK_*_DIRECTORIES`` variables were defined to tell
  80. :ref:`Visual Studio Generators` for VS 2010 and above how to populate
  81. fields in ``.vcxproj`` files that specify SDK directories. The
  82. variables are:
  83. - :variable:`CMAKE_VS_SDK_EXCLUDE_DIRECTORIES`
  84. - :variable:`CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES`
  85. - :variable:`CMAKE_VS_SDK_INCLUDE_DIRECTORIES`
  86. - :variable:`CMAKE_VS_SDK_LIBRARY_DIRECTORIES`
  87. - :variable:`CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES`
  88. - :variable:`CMAKE_VS_SDK_REFERENCE_DIRECTORIES`
  89. - :variable:`CMAKE_VS_SDK_SOURCE_DIRECTORIES`
  90. * A :variable:`MSVC_TOOLSET_VERSION` variable was added to provide the
  91. MSVC toolset version associated with the current MSVC compiler version
  92. in :variable:`MSVC_VERSION`.
  93. Properties
  94. ----------
  95. * The :prop_tgt:`COMMON_LANGUAGE_RUNTIME` target property was introduced
  96. to configure the use of managed C++ for :ref:`Visual Studio Generators`
  97. for VS 2010 and above.
  98. A corresponding :prop_tgt:`IMPORTED_COMMON_LANGUAGE_RUNTIME` target
  99. property was added to support ``C++/CLI`` for imported targets.
  100. * The :prop_tgt:`DOTNET_TARGET_FRAMEWORK_VERSION` target property
  101. was introduced as replacement for
  102. :prop_tgt:`VS_DOTNET_TARGET_FRAMEWORK_VERSION`, which is considered
  103. deprecated now.
  104. * An :prop_tgt:`EXPORT_PROPERTIES` target property was added to specify a
  105. custom list of target properties to include in targets exported by the
  106. :command:`install(EXPORT)` and :command:`export` commands.
  107. * The :prop_tgt:`PDB_OUTPUT_DIRECTORY` property learned to support
  108. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  109. * A :prop_dir:`TESTS` directory property was added to hold the list of
  110. tests defined by the :command:`add_test` command.
  111. * A :prop_tgt:`VS_DEBUGGER_COMMAND` target property was created to set the
  112. debugging command line with :ref:`Visual Studio Generators` for VS 2010
  113. and above.
  114. * HLSL source file properties :prop_sf:`VS_SHADER_DISABLE_OPTIMIZATIONS`
  115. and :prop_sf:`VS_SHADER_ENABLE_DEBUG` gained support for generator
  116. expressions.
  117. * HLSL source file property :prop_sf:`VS_SHADER_OBJECT_FILE_NAME` has been
  118. added to the :ref:`Visual Studio Generators` for VS 2010 and above.
  119. The property specifies the file name of the compiled shader object.
  120. Modules
  121. -------
  122. * The :module:`FindALSA` module now provides imported targets.
  123. * The :module:`FindCURL` module now provides imported targets.
  124. * The :module:`FindJPEG` module now provides imported targets.
  125. * The :module:`FindLibXml2` module now provides imported targets.
  126. * A :module:`FindODBC` module was added to find an Open Database Connectivity
  127. (ODBC) library.
  128. * The :module:`FindPkgConfig` module has learned to export the found
  129. libraries with full path for direct consumption with the
  130. :command:`target_link_libraries` command.
  131. * New :module:`FindPython3` and :module:`FindPython2` modules, as well as
  132. a new :module:`FindPython` module, have been added to provide a new way
  133. to locate python environments.
  134. * The :module:`UseSWIG` module gained a whole refresh and is now more
  135. consistent with standard CMake commands to generate libraries and is
  136. fully configurable through properties.
  137. * The :module:`UseSWIG` module learned to manage multiple behaviors through
  138. ``UseSWIG_MODULE_VERSION`` variable to ensure legacy support as well as more
  139. robust handling of ``SWIG`` advanced features (like ``%template``).
  140. * The :module:`UseSWIG` module learned to support CSHARP variant
  141. wrapper files.
  142. * The :module:`WriteCompilerDetectionHeader` module gained a ``BARE_FEATURES``
  143. option to add a compatibility define for the exact keyword of a new language
  144. feature.
  145. Generator Expressions
  146. ---------------------
  147. * A new ``$<GENEX_EVAL:...>`` and ``$<TARGET_GENEX_EVAL:target,...>``
  148. :manual:`generator expression <cmake-generator-expressions(7)>`
  149. has been added to enable consumption of generator expressions whose
  150. evaluation results itself in generator expressions.
  151. * A new ``$<IN_LIST:...>``
  152. :manual:`generator expression <cmake-generator-expressions(7)>`
  153. has been added.
  154. * A new ``$<TARGET_EXISTS:...>``
  155. :manual:`generator expression <cmake-generator-expressions(7)>`
  156. has been added.
  157. * A new ``$<TARGET_NAME_IF_EXISTS:...>``
  158. :manual:`generator expression <cmake-generator-expressions(7)>`
  159. has been added.
  160. CTest
  161. -----
  162. * The :command:`ctest_start` command has been reworked so that you can simply
  163. call ``ctest_start(APPEND)`` and it will read all the needed information from
  164. the TAG file. The argument parsing has also been relaxed so that the order of
  165. the arguments is less significant.
  166. * A :prop_test:`PROCESSOR_AFFINITY` test property was added to request
  167. that CTest run a test with CPU affinity for a set of processors
  168. disjoint from other concurrently running tests with the property set.
  169. CPack
  170. -----
  171. * The :module:`CPack` module now uses variables
  172. :variable:`CMAKE_PROJECT_VERSION_MAJOR`,
  173. :variable:`CMAKE_PROJECT_VERSION_MINOR` and
  174. :variable:`CMAKE_PROJECT_VERSION_PATCH`
  175. to initialize corresponding CPack variables.
  176. * :manual:`cpack(1)` gained basic support for `NuGet`_.
  177. See the :module:`CPackNuGet` module.
  178. .. _NuGet: https://docs.microsoft.com/en-us/nuget/what-is-nuget
  179. Other
  180. -----
  181. * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
  182. is now aware of C++ 20. No specific features are yet enumerated besides
  183. the ``cxx_std_20`` meta-feature.
  184. * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
  185. is now aware of the availability of C features in MSVC since VS 2010.
  186. * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
  187. is now aware of C language standards supported by Texas Instruments C
  188. compilers.
  189. Deprecated and Removed Features
  190. ===============================
  191. * The :generator:`Visual Studio 8 2005` generator has been removed.
  192. * CMake no longer produces ``<tgt>_LIB_DEPENDS`` cache entries
  193. for library targets. See policy :policy:`CMP0073`.
  194. Other Changes
  195. =============
  196. * Include flags for directories marked as ``SYSTEM`` are now moved after
  197. non-system directories. The ``-isystem`` flag does this automatically,
  198. so moving them explicitly to the end makes the behavior consistent on
  199. compilers that do not have any ``-isystem`` flag.
  200. * Fortran dependency scanning now supports dependencies implied by
  201. `Fortran Submodules`_.
  202. * The existence and functionality of the file
  203. ``${CMAKE_BINARY_DIR}/cmake_install.cmake`` has now been documented in the
  204. :command:`install` documentation so that external packaging software can take
  205. advantage of CPack-style component installs.
  206. * The :module:`CheckIncludeFile` module ``check_include_file`` macro
  207. learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
  208. See policy :policy:`CMP0075`.
  209. * The :module:`CheckIncludeFileCXX` module ``check_include_file_cxx`` macro
  210. learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
  211. See policy :policy:`CMP0075`.
  212. * The :module:`CheckIncludeFiles` module ``check_include_files`` macro
  213. learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
  214. See policy :policy:`CMP0075`.
  215. * The :manual:`cmake(1)` ``-E copy_directory`` tool now fails when the
  216. source directory does not exist. Previously it succeeded by creating
  217. an empty destination directory.
  218. * The :module:`UseSWIG` module :command:`swig_add_library` command
  219. (and legacy ``swig_add_module`` command) now set the prefix of
  220. Java modules to ``""`` for MINGW, MSYS, and CYGWIN environments.
  221. .. _`Fortran Submodules`: http://fortranwiki.org/fortran/show/Submodules