3.11.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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:`CheckIncludeFiles` module :command:`CHECK_INCLUDE_FILES`
  97. command gained a ``LANGUAGE`` option to specify whether to check using the
  98. ``C`` or ``CXX`` compiler.
  99. * The :module:`CMakePackageConfigHelpers` module
  100. :command:`write_basic_package_version_file` command learned a new
  101. ``SameMinorVersion`` mode for the ``COMPATIBILITY`` argument.
  102. * The :module:`ExternalProject` module learned to substitute ``<DOWNLOAD_DIR>``
  103. in comments, commands, working directory and byproducts.
  104. * The :module:`ExternalProject` module gained ``NETRC`` and ``NETRC_FILE``
  105. options to specify use of a ``.netrc`` file.
  106. * A new :module:`FetchContent` module was added which supports populating
  107. content at configure time using any of the download/update methods
  108. supported by :command:`ExternalProject_Add`. This allows the content
  109. to be used immediately during the configure stage, such as with
  110. :command:`add_subdirectory`, etc. Hierarchical project structures are
  111. well supported, allowing parent projects to override the content details
  112. of child projects and ensuring content is not populated multiple times
  113. throughout the whole project tree.
  114. * The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to support
  115. `FLAME`_ ``blis`` and ``libflame``.
  116. * The :module:`FindDoxygen` module :command:`doxygen_add_docs` function
  117. now supports a new ``DOXYGEN_VERBATIM_VARS`` list variable. Any
  118. ``DOXYGEN_...`` variable contained in that list will bypass the automatic
  119. quoting logic, leaving its contents untouched when transferring them to the
  120. output ``Doxyfile``.
  121. * A :module:`FindIconv` module was added to locate iconv support.
  122. * The :module:`GenerateExportHeader` module ``GENERATE_EXPORT_HEADER`` command
  123. gained an ``INCLUDE_GUARD_NAME`` option to change the name of the include
  124. guard symbol written to the generated export header.
  125. Additionally, it now adds a comment after the closing ``#endif`` on the
  126. generated export header's include guard.
  127. * The :module:`UseJava` module ``add_jar`` command gained a
  128. ``GENERATE_NATIVE_HEADERS`` option to generate native header files
  129. using ``javac -h`` for ``javac`` 1.8 or above. This supersedes
  130. ``create_javah``, which no longer works with JDK 1.10 and above due
  131. to removal of the ``javah`` tool by `JEP 313`_.
  132. .. _`FLAME`: https://github.com/flame
  133. .. _`JEP 313`: http://openjdk.java.net/jeps/313
  134. Autogen
  135. -------
  136. * When using :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC`, CMake now starts
  137. multiple parallel ``moc`` or ``uic`` processes to reduce the build time.
  138. A new :variable:`CMAKE_AUTOGEN_PARALLEL` variable and
  139. :prop_tgt:`AUTOGEN_PARALLEL` target property may be set to specify the
  140. number of parallel ``moc`` or ``uic`` processes to start. The default
  141. is derived from the number of CPUs on the host.
  142. CTest
  143. -----
  144. * The :command:`ctest_start` command no longer sets
  145. :variable:`CTEST_RUN_CURRENT_SCRIPT` due to issues with scoping if it is
  146. called from inside a function. Instead, it sets an internal variable in
  147. CTest. However, setting :variable:`CTEST_RUN_CURRENT_SCRIPT` to 0 at the
  148. global scope still prevents the script from being re-run at the end.
  149. CPack
  150. -----
  151. * :manual:`cpack(1)` gained ``--trace`` and ``--trace-expand`` options.
  152. * The :cpack_gen:`CPack IFW Generator` gained new
  153. :variable:`CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR` variable to control
  154. if the target directory should not be deleted when uninstalling.
  155. * The :cpack_gen:`CPack RPM Generator` learned to enable enforcing of execute
  156. privileges on programs and shared libraries.
  157. See :variable:`CPACK_RPM_INSTALL_WITH_EXEC` variable.
  158. * A :variable:`CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` variable was added
  159. which serves the same purpose during packaging (e.g. ``make package``) as the
  160. :variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` variable serves during
  161. installation (e.g. ``make install``).
  162. Other
  163. -----
  164. * :ref:`Alias Targets` may now alias :ref:`Imported Targets` that are
  165. created with the ``GLOBAL`` option to :command:`add_library`.
  166. * :ref:`Interface Libraries` may now have custom properties set on them if
  167. they start with either an underscore (``_``) or a lowercase ASCII character.
  168. The original intention was to only allow properties which made sense for
  169. ``INTERFACE`` libraries, but it also blocked usage of custom properties.
  170. * The :manual:`cmake(1)` ``--open <dir>`` command-line option was added
  171. to open generated IDE projects like Visual Studio solutions or Xcode
  172. projects.
  173. Deprecated and Removed Features
  174. ===============================
  175. * An explicit deprecation diagnostic was added for policies ``CMP0037``
  176. through ``CMP0054`` (``CMP0036`` and below were already deprecated).
  177. The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
  178. of all policies are deprecated and that projects should port to the
  179. NEW behaviors.
  180. * The ``KDevelop3`` generator has been removed.
  181. Other Changes
  182. =============
  183. * Policy :policy:`CMP0037` no longer reserves target names associated
  184. with optional features, such as ``test`` and ``package``, unless
  185. the corresponding feature is enabled.
  186. * The :module:`FindOpenGL` module now prefers GLVND libraries if available.
  187. See policy :policy:`CMP0072`.
  188. * The minimum deployment target set in the
  189. :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` variable used to be only
  190. applied for macOS regardless of the selected SDK. It is now properly
  191. set for the target platform selected by :variable:`CMAKE_OSX_SYSROOT`.
  192. For example, if the sysroot variable specifies an iOS SDK then the
  193. value in ``CMAKE_OSX_DEPLOYMENT_TARGET`` is interpreted as minimum
  194. iOS version.
  195. * The :generator:`Xcode` generator behavior of generating one project
  196. file per :command:`project()` command may now be controlled with the
  197. :variable:`CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY` variable.
  198. This could be useful to speed up the CMake generation step for
  199. large projects and to work-around a bug in the ``ZERO_CHECK`` logic.
  200. * Since the ``CMakeCache.txt`` format does not support newlines in values,
  201. values containing newlines are now truncated before writing to the file.
  202. In addition, a warning comment is written to the cache file, and a warning
  203. message is displayed to the user on the console.
  204. Updates
  205. =======
  206. Changes made since CMake 3.11.0 include the following.
  207. 3.11.1
  208. ------
  209. * The :module:`CheckIncludeFile` module ``check_include_file`` macro,
  210. :module:`CheckIncludeFileCXX` module ``check_include_file_cxx`` macro,
  211. and :module:`CheckIncludeFiles` module ``check_include_files`` macro
  212. were taught to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable in
  213. CMake 3.11.0. This has been reverted due to changing behavior of
  214. checks for existing projects. It may be restored in the future
  215. with a policy for compatibility.
  216. 3.11.2
  217. ------
  218. * Calling :command:`add_library` to create an alias of an imported
  219. target that is not globally visible now causes an error again as
  220. it did prior to 3.11.0. This diagnostic was accidentally dropped
  221. from CMake 3.11.0 and 3.11.1 by the change to allow globally visible
  222. imported targets to be aliased.
  223. * The :module:`FindQt4` module ``qt4_wrap_cpp``, ``qt4_wrap_ui`` and
  224. ``qt4_add_resources`` macros now set :prop_sf:`SKIP_AUTOMOC` and
  225. :prop_sf:`SKIP_AUTOUIC` on their generated files. These files never
  226. need to be processed by moc or uic, and we must say so explicitly to
  227. account for policy :policy:`CMP0071`.
  228. 3.11.3
  229. ------
  230. * CMake 3.11.0 introduced support for resolving symbolic links on
  231. Windows in code paths that typically do so on UNIX. This has been
  232. reverted due to breakage on ``subst`` drives.