3.11.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. CMake 3.11 Release Notes
  2. ************************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.10 include the following.
  6. New Features
  7. ============
  8. Platforms
  9. ---------
  10. * TI C/C++ compilers are now supported by the :generator:`Ninja` generator.
  11. Generators
  12. ----------
  13. * The :generator:`CodeBlocks` extra generator learned to check a
  14. :variable:`CMAKE_CODEBLOCKS_COMPILER_ID` variable for a custom
  15. compiler identification value to place in the project file.
  16. * The :ref:`Makefile Generators` and the :generator:`Ninja` generator learned
  17. to add compiler launcher tools along with the compiler for the ``Fortran``
  18. language (``C``, ``CXX``, and ``CUDA`` were supported previously).
  19. See the :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable and
  20. :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property for details.
  21. * :ref:`Visual Studio Generators` learned to support the ``COMPILE_LANGUAGE``
  22. :manual:`generator expression <cmake-generator-expressions(7)>` in
  23. target-wide :prop_tgt:`COMPILE_DEFINITIONS`,
  24. :prop_tgt:`INCLUDE_DIRECTORIES`, :prop_tgt:`COMPILE_OPTIONS`, and
  25. :command:`file(GENERATE)`. See generator expression documentation
  26. for caveats.
  27. * The :generator:`Xcode` generator learned to support the ``COMPILE_LANGUAGE``
  28. :manual:`generator expression <cmake-generator-expressions(7)>` in
  29. target-wide :prop_tgt:`COMPILE_DEFINITIONS` and
  30. :prop_tgt:`INCLUDE_DIRECTORIES`. It previously supported only
  31. :prop_tgt:`COMPILE_OPTIONS` and :command:`file(GENERATE)`.
  32. See generator expression documentation for caveats.
  33. Commands
  34. --------
  35. * :command:`add_library` and :command:`add_executable` commands can now be
  36. called without any sources and will not complain as long as sources are
  37. added later via the :command:`target_sources` command.
  38. * The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands
  39. gained ``NETRC`` and ``NETRC_FILE`` options to specify use of a
  40. ``.netrc`` file.
  41. * The :command:`target_compile_definitions` command learned to set the
  42. :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` property on
  43. :ref:`Imported Targets`.
  44. * The :command:`target_compile_features` command learned to set the
  45. :prop_tgt:`INTERFACE_COMPILE_FEATURES` property on :ref:`Imported Targets`.
  46. * The :command:`target_compile_options` command learned to set the
  47. :prop_tgt:`INTERFACE_COMPILE_OPTIONS` property on :ref:`Imported Targets`.
  48. * The :command:`target_include_directories` command learned to set the
  49. :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` property on
  50. :ref:`Imported Targets`.
  51. * The :command:`target_sources` command learned to set the
  52. :prop_tgt:`INTERFACE_SOURCES` property on :ref:`Imported Targets`.
  53. * The :command:`target_link_libraries` command learned to set the
  54. :prop_tgt:`INTERFACE_LINK_LIBRARIES` property on :ref:`Imported Targets`.
  55. Variables
  56. ---------
  57. * A :variable:`CMAKE_GENERATOR_INSTANCE` variable was introduced
  58. to hold the selected instance of the generator's corresponding
  59. native tools if multiple are available. This is used by the
  60. :generator:`Visual Studio 15 2017` generator to hold the
  61. selected instance of Visual Studio persistently.
  62. * A :variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` variable was added
  63. to enable setting of default permissions for directories created implicitly
  64. during installation of files by :command:`install` and
  65. :command:`file(INSTALL)`, e.g. during ``make install``.
  66. * A :variable:`CMAKE_JOB_POOLS` variable was added specify a value to use for
  67. the :prop_gbl:`JOB_POOLS` property. This enables control over build
  68. parallelism with command line configuration parameters when using the Ninja
  69. generator.
  70. * The :variable:`CMAKE_NETRC` and :variable:`CMAKE_NETRC_FILE` variables
  71. were added to specify use of a ``.netrc`` file by the
  72. :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands and
  73. the :module:`ExternalProject` module.
  74. * A :variable:`CMAKE_CUDA_SEPARABLE_COMPILATION` variable was added to
  75. initialize the :prop_tgt:`CUDA_SEPARABLE_COMPILATION` target property
  76. on targets when they are created.
  77. Properties
  78. ----------
  79. * The :prop_sf:`COMPILE_DEFINITIONS` source file property learned to support
  80. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  81. * A :prop_sf:`COMPILE_OPTIONS` source file property was added to manage list
  82. of options to pass to the compiler.
  83. * An :prop_tgt:`IMPORTED_GLOBAL` target property was added to indicate
  84. whether an :ref:`IMPORTED target <Imported Targets>` is globally visible.
  85. It is automatically set to a true value for targets created with the
  86. ``GLOBAL`` option to :command:`add_library` or :command:`add_executable`.
  87. Additionally, project code may now *promote* a local imported target
  88. to be globally visible by setting this property to ``TRUE``.
  89. * An :prop_sf:`INCLUDE_DIRECTORIES` source file property was added to specify
  90. list of preprocessor include file search directories.
  91. * Source file properties :prop_sf:`VS_SHADER_DISABLE_OPTIMIZATIONS` and
  92. :prop_sf:`VS_SHADER_ENABLE_DEBUG` have been added to specify more
  93. details of ``.hlsl`` sources with :ref:`Visual Studio Generators`.
  94. Modules
  95. -------
  96. * The :module:`CheckIncludeFile` module ``check_include_file`` macro
  97. learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
  98. * The :module:`CheckIncludeFileCXX` module ``check_include_file_cxx`` macro
  99. learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
  100. * The :module:`CheckIncludeFiles` module ``check_include_files`` macro
  101. learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
  102. * The :module:`CheckIncludeFiles` module :command:`CHECK_INCLUDE_FILES`
  103. command gained a ``LANGUAGE`` option to specify whether to check using the
  104. ``C`` or ``CXX`` compiler.
  105. * The :module:`CMakePackageConfigHelpers` module
  106. :command:`write_basic_package_version_file` command learned a new
  107. ``SameMinorVersion`` mode for the ``COMPATIBILITY`` argument.
  108. * The :module:`ExternalProject` module learned to substitute ``<DOWNLOAD_DIR>``
  109. in comments, commands, working directory and byproducts.
  110. * The :module:`ExternalProject` module gained ``NETRC`` and ``NETRC_FILE``
  111. options to specify use of a ``.netrc`` file.
  112. * A new :module:`FetchContent` module was added which supports populating
  113. content at configure time using any of the download/update methods
  114. supported by :command:`ExternalProject_Add`. This allows the content
  115. to be used immediately during the configure stage, such as with
  116. :command:`add_subdirectory`, etc. Hierarchical project structures are
  117. well supported, allowing parent projects to override the content details
  118. of child projects and ensuring content is not populated multiple times
  119. throughout the whole project tree.
  120. * The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to support
  121. `FLAME`_ ``blis`` and ``libflame``.
  122. * The :module:`FindDoxygen` module :command:`doxygen_add_docs` function
  123. now supports a new ``DOXYGEN_VERBATIM_VARS`` list variable. Any
  124. ``DOXYGEN_...`` variable contained in that list will bypass the automatic
  125. quoting logic, leaving its contents untouched when transferring them to the
  126. output ``Doxyfile``.
  127. * A :module:`FindIconv` module was added to locate iconv support.
  128. * The :module:`GenerateExportHeader` module ``GENERATE_EXPORT_HEADER`` command
  129. gained an ``INCLUDE_GUARD_NAME`` option to change the name of the include
  130. guard symbol written to the generated export header.
  131. Additionally, it now adds a comment after the closing ``#endif`` on the
  132. generated export header's include guard.
  133. * The :module:`UseJava` module ``add_jar`` command gained a
  134. ``GENERATE_NATIVE_HEADERS`` option to generate native header files
  135. using ``javac -h`` for ``javac`` 1.8 or above. This supersedes
  136. ``create_javah``, which no longer works with JDK 1.10 and above due
  137. to removal of the ``javah`` tool by `JEP 313`_.
  138. .. _`FLAME`: https://github.com/flame
  139. .. _`JEP 313`: http://openjdk.java.net/jeps/313
  140. Autogen
  141. -------
  142. * When using :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC`, CMake now starts
  143. multiple parallel ``moc`` or ``uic`` processes to reduce the build time.
  144. A new :variable:`CMAKE_AUTOGEN_PARALLEL` variable and
  145. :prop_tgt:`AUTOGEN_PARALLEL` target property may be set to specify the
  146. number of parallel ``moc`` or ``uic`` processes to start. The default
  147. is derived from the number of CPUs on the host.
  148. CTest
  149. -----
  150. * The :command:`ctest_start` command no longer sets
  151. :variable:`CTEST_RUN_CURRENT_SCRIPT` due to issues with scoping if it is
  152. called from inside a function. Instead, it sets an internal variable in
  153. CTest. However, setting :variable:`CTEST_RUN_CURRENT_SCRIPT` to 0 at the
  154. global scope still prevents the script from being re-run at the end.
  155. CPack
  156. -----
  157. * :manual:`cpack(1)` gained ``--trace`` and ``--trace-expand`` options.
  158. * The :module:`CPackIFW` module gained new
  159. :variable:`CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR` variable to control
  160. if the target directory should not be deleted when uninstalling.
  161. * The :module:`CPackRPM` module learned to enable enforcing of execute
  162. privileges on programs and shared libraries.
  163. See :variable:`CPACK_RPM_INSTALL_WITH_EXEC` variable.
  164. * A :variable:`CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` variable was added
  165. which serves the same purpose during packaging (e.g. ``make package``) as the
  166. :variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` variable serves during
  167. installation (e.g. ``make install``).
  168. Other
  169. -----
  170. * :ref:`Alias Targets` may now alias :ref:`Imported Targets` that are
  171. created with the ``GLOBAL`` option to :command:`add_library`.
  172. * :ref:`Interface Libraries` may now have custom properties set on them if
  173. they start with either an underscore (``_``) or a lowercase ASCII character.
  174. The original intention was to only allow properties which made sense for
  175. ``INTERFACE`` libraries, but it also blocked usage of custom properties.
  176. * The :manual:`cmake(1)` ``--open <dir>`` command-line option was added
  177. to open generated IDE projects like Visual Studio solutions or Xcode
  178. projects.
  179. Deprecated and Removed Features
  180. ===============================
  181. * An explicit deprecation diagnostic was added for policies ``CMP0037``
  182. through ``CMP0054`` (``CMP0036`` and below were already deprecated).
  183. The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
  184. of all policies are deprecated and that projects should port to the
  185. NEW behaviors.
  186. * The ``KDevelop3`` generator has been removed.
  187. Other Changes
  188. =============
  189. * Policy :policy:`CMP0037` no longer reserves target names associated
  190. with optional features, such as ``test`` and ``package``, unless
  191. the corresponding feature is enabled.
  192. * The :module:`FindOpenGL` module now prefers GLVND libraries if available.
  193. See policy :policy:`CMP0072`.
  194. * The minimum deployment target set in the
  195. :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` variable used to be only
  196. applied for macOS regardless of the selected SDK. It is now properly
  197. set for the target platform selected by :variable:`CMAKE_OSX_SYSROOT`.
  198. For example, if the sysroot variable specifies an iOS SDK then the
  199. value in ``CMAKE_OSX_DEPLOYMENT_TARGET`` is interpreted as minimum
  200. iOS version.
  201. * The :generator:`Xcode` generator behavior of generating one project
  202. file per :command:`project()` command may now be controlled with the
  203. :variable:`CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY` variable.
  204. This could be useful to speed up the CMake generation step for
  205. large projects and to work-around a bug in the ``ZERO_CHECK`` logic.
  206. * Since the ``CMakeCache.txt`` format does not support newlines in values,
  207. values containing newlines are now truncated before writing to the file.
  208. In addition, a warning comment is written to the cache file, and a warning
  209. message is displayed to the user on the console.