3.9.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. CMake 3.9 Release Notes
  2. ***********************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.8 include the following.
  6. New Features
  7. ============
  8. Languages
  9. ---------
  10. * ``CUDA`` is now supported by the :ref:`Visual Studio Generators`
  11. for VS 2010 and above. This complements the existing support by the
  12. :ref:`Makefile Generators` and the :generator:`Ninja` generator.
  13. * CMake is now aware of the :prop_tgt:`C++ standards <CXX_STANDARD>` and
  14. :prop_tgt:`C standards <C_STANDARD>` and their associated meta-features for
  15. the following :variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>`: ``Cray``,
  16. ``PGI``, and ``XL``.
  17. Generators
  18. ----------
  19. * :ref:`Visual Studio Generators` for VS 2010 and above learned to support
  20. the ``ASM_NASM`` language when ``nasm`` is installed.
  21. * The :generator:`Xcode` generator learned to create Xcode schema files.
  22. This is an experimental feature and can be activated by setting the
  23. :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable to a ``TRUE`` value.
  24. Commands
  25. --------
  26. * The :command:`add_library` command ``IMPORTED`` option learned to support
  27. :ref:`Object Libraries`.
  28. * All ``find_`` commands now have a ``PACKAGE_ROOT`` search path group that
  29. is first in the search heuristics. If a ``find_`` command is called from
  30. inside a find module, then the CMake variable and environment variable named
  31. ``<PackageName>_ROOT`` are used as prefixes and are the first set of paths
  32. to be searched.
  33. * The :command:`find_library` command learned to search ``libx32`` paths
  34. when the build targets the ``x32`` ABI. See the
  35. :prop_gbl:`FIND_LIBRARY_USE_LIBX32_PATHS` global property.
  36. * The :command:`include_external_msproject` command learned to use
  37. the :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property
  38. to map current configurations to the external configurations.
  39. * The :command:`install(TARGETS)` command learned a new ``OBJECTS`` option to
  40. specify where to install :ref:`Object Libraries`.
  41. * The :command:`install(EXPORT)` command learned how to export
  42. :ref:`Object Libraries`.
  43. * The :command:`project` command learned an optional ``DESCRIPTION``
  44. parameter to set the :variable:`PROJECT_DESCRIPTION` variable.
  45. * The :command:`separate_arguments` command gained a ``NATIVE_COMMAND`` mode
  46. that performs argument separation depending on the host operating system.
  47. Variables
  48. ---------
  49. * A :variable:`CMAKE_ANDROID_NDK_DEPRECATED_HEADERS` variable was added
  50. for use when :ref:`Cross Compiling for Android with the NDK` to request
  51. use of the deprecated headers even when unified headers are available.
  52. The default is now to use unified headers if available.
  53. * A :variable:`CMAKE_AUTOMOC_DEPEND_FILTERS` variable was introduced to
  54. allow :variable:`CMAKE_AUTOMOC` to extract additional dependency file names
  55. for ``moc`` from the contents of source files.
  56. * A :variable:`CMAKE_AUTOUIC_SEARCH_PATHS` variable was introduced to
  57. allow :variable:`CMAKE_AUTOUIC` to search for ``foo.ui`` in more
  58. places than the vicinity of the file including ``ui_foo.h``.
  59. * A :variable:`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable was added to
  60. tell the :command:`find_library` command to search in a ``lib<suffix>``
  61. directory before each ``lib`` directory that would normally be searched.
  62. * A :variable:`CMAKE_INTERPROCEDURAL_OPTIMIZATION` variable was added to
  63. initialize the :prop_tgt:`INTERPROCEDURAL_OPTIMIZATION` property on all
  64. targets.
  65. * A :variable:`CMAKE_<LANG>_COMPILER_AR` variable was added to hold
  66. the path to the GCC/Clang wrapper of ``ar``.
  67. * A :variable:`CMAKE_<LANG>_COMPILER_RANLIB` variable was added to hold
  68. the path to the GCC/Clang wrapper of ``ranlib``.
  69. * The :variable:`CMAKE_SYSROOT_COMPILE` and :variable:`CMAKE_SYSROOT_LINK`
  70. variables were added to use separate sysroots for compiling and linking.
  71. Properties
  72. ----------
  73. * A new :prop_tgt:`AUTOGEN_BUILD_DIR` target property was introduced to set
  74. a custom output directory for :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC`,
  75. and :prop_tgt:`AUTORCC`.
  76. * A new :prop_tgt:`AUTOMOC_DEPEND_FILTERS` target property was introduced to
  77. allow :prop_tgt:`AUTOMOC` to extract additional dependency file names
  78. for ``moc`` from the contents of source files.
  79. * A new :prop_tgt:`AUTOUIC_SEARCH_PATHS` target property was introduced to
  80. allow :prop_tgt:`AUTOUIC` to search for ``foo.ui`` in more
  81. places than the vicinity of the file including ``ui_foo.h``.
  82. * Global properties :prop_gbl:`AUTOGEN_SOURCE_GROUP`,
  83. :prop_gbl:`AUTOMOC_SOURCE_GROUP` and
  84. :prop_gbl:`AUTORCC_SOURCE_GROUP` were
  85. introduced to allow files generated by :prop_tgt:`AUTOMOC` or
  86. :prop_tgt:`AUTORCC` to be placed in a :command:`source_group`.
  87. * A :prop_tgt:`BUILD_WITH_INSTALL_NAME_DIR` target property and corresponding
  88. :variable:`CMAKE_BUILD_WITH_INSTALL_NAME_DIR` variable were added to
  89. control whether to use the :prop_tgt:`INSTALL_NAME_DIR` target property
  90. value for binaries in the build tree. This is for macOS ``install_name``
  91. as :prop_tgt:`BUILD_WITH_INSTALL_RPATH` is for ``RPATH``.
  92. * A :prop_tgt:`CUDA_PTX_COMPILATION` target property was added to
  93. :ref:`Object Libraries` to support compiling to ``.ptx`` files
  94. instead of host object files.
  95. * A :prop_gbl:`GENERATOR_IS_MULTI_CONFIG` global property was
  96. added to determine whether the current generator is a multi-configuration
  97. generator (such as :ref:`Visual Studio Generators` or :generator:`Xcode`).
  98. * The :prop_tgt:`INTERPROCEDURAL_OPTIMIZATION` target property is now enforced
  99. when enabled. CMake will add IPO flags unconditionally or produce an error
  100. if it does not know the flags for the current compiler. The project is now
  101. responsible to use the :module:`CheckIPOSupported` module to check for IPO
  102. support before enabling the target property. See policy :policy:`CMP0069`.
  103. * The :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property may now
  104. be used in combination with explicit ``.def`` files in order to
  105. export all symbols from the object files within a target plus
  106. an explicit list of symbols that the linker finds in dependencies
  107. (e.g. ``msvcrt.lib``).
  108. Modules
  109. -------
  110. * A :module:`CheckIPOSupported` module was added to help projects
  111. check whether interprocedural optimization (IPO) is supported by
  112. the current toolchain and CMake version.
  113. * The :module:`CMakeFindDependencyMacro` module ``find_dependency`` macro
  114. now forwards all arguments to the underlying :command:`find_package`
  115. call. Existing uses will continue to function as before, but callers can
  116. now access the full suite of arguments that ``find_package`` accepts.
  117. * The :module:`FeatureSummary` module :command:`feature_summary` command now
  118. accepts the new ``DEFAULT_DESCRIPTION`` option that will print the default
  119. title for the selected package type.
  120. * The :module:`FeatureSummary` module gained a new
  121. :variable:`FeatureSummary_<TYPE>_DESCRIPTION` variable that can be defined
  122. for each ``<TYPE>`` to replace the type name with the specified string
  123. whenever the package type is used in an output string by the module.
  124. * The :module:`FindDoxygen` module learned to control Doxygen behavior using
  125. CMake variables and generate documentation via the newly added
  126. :command:`doxygen_add_docs` function. The Doxygen input file (``Doxyfile``)
  127. is automatically generated and doxygen is run as part of a custom target.
  128. Additional components can be specified to find optional tools: ``dot``,
  129. ``mscgen`` and ``dia``.
  130. * The :module:`FindMPI` module now provides imported targets.
  131. * The :module:`FindProtobuf` module :command:`protobuf_generate_cpp`
  132. command gained an ``EXPORT_MACRO`` option to specify the name of
  133. a DLL export markup macro.
  134. * The :module:`FindProtobuf` module now supports usage of static libraries
  135. for Unix via a new ``Protobuf_USE_STATIC_LIBS`` input variable.
  136. * The :module:`FindProtobuf` module now provides imported targets
  137. when the libraries are found.
  138. * A new :module:`GoogleTest` module was added to provide the
  139. :command:`gtest_add_tests` function independently of the :module:`FindGTest`
  140. module. The function was also updated to support keyword arguments, with
  141. functionality expanded to allow a test name prefix and suffix to be
  142. specified, the dependency on the source files to be optional and the list of
  143. discovered test cases to be returned to the caller.
  144. CTest
  145. -----
  146. * The :command:`ctest_submit` command gained a ``HTTPHEADER`` option
  147. to specify custom headers to send during submission.
  148. * The :manual:`ctest(1)` executable gained new options which allow the
  149. developer to disable automatically adding tests to the test set to satisfy
  150. fixture dependencies. ``-FS`` prevents adding setup tests for fixtures
  151. matching the provided regular expression, ``-FC`` prevents adding cleanup
  152. tests for matching fixtures and ``-FA`` prevents adding any test for matching
  153. fixtures.
  154. * A :prop_test:`DISABLED` test property was added to mark tests that
  155. are configured but explicitly disabled so they do not run.
  156. CPack
  157. -----
  158. * The :module:`CPackArchive` module learned to modify the filename
  159. per-component. See the :variable:`CPACK_ARCHIVE_FILE_NAME` variable and
  160. its per-component version :variable:`CPACK_ARCHIVE_<component>_FILE_NAME`.
  161. * The :module:`CPackComponent` module :command:`cpack_add_component` command
  162. gained a new ``PLIST <filename>`` option to specify the ``pkgbuild``
  163. ``--component-plist`` argument when using the
  164. :module:`productbuild <CPackProductBuild>` generator.
  165. * The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
  166. :command:`cpack_ifw_configure_component_group` commands gained
  167. internationalization support for ``DISPLAY_NAME`` and ``DESCRIPTION``
  168. options.
  169. * The :module:`CPackIFW` module learned the new hint :variable:`CPACK_IFW_ROOT`
  170. variable for finding the QtIFW tool suite installed in a non-standard place.
  171. * The :module:`CPackProductBuild` module gained a new
  172. :variable:`CPACK_PRODUCTBUILD_RESOURCES_DIR` variable to
  173. specify resources to be copied into the ``Resources``
  174. directory.
  175. * The :module:`CPackRPM` module learned to modify the ``debuginfo`` package
  176. name. See the :variable:`CPACK_RPM_DEBUGINFO_FILE_NAME` variable.
  177. * The :module:`CPackWIX` module patching system now has the ability to set
  178. additional attributes. This can be done by specifying attributes with
  179. the ``CPackWiXFragment`` XML tag after the ``Id`` attribute.
  180. See the :variable:`CPACK_WIX_PATCH_FILE` variable.
  181. * The CPack WIX generator implemented a new
  182. :variable:`CPACK_WIX_ROOT_FOLDER_ID` variable which allows
  183. using a custom root folder ID instead of the default
  184. ``ProgramFilesFolder`` / ``ProgramFiles64Folder``.
  185. Other
  186. -----
  187. * Interprocedural optimization (IPO) is now supported for GNU and Clang
  188. compilers using link time optimization (LTO) flags. See the
  189. :prop_tgt:`INTERPROCEDURAL_OPTIMIZATION` target property and
  190. :module:`CheckIPOSupported` module.
  191. * The ``TARGET_OBJECTS``
  192. :manual:`generator expression <cmake-generator-expressions(7)>`
  193. is now supported by the :command:`add_custom_command` and
  194. :command:`file(GENERATE)` commands.
  195. * Two new informational generator expressions to retrieve Apple Bundle
  196. directories have been added. The first one ``$<TARGET_BUNDLE_DIR:tgt>``
  197. outputs the full path to the Bundle directory, the other one
  198. ``$<TARGET_BUNDLE_CONTENT_DIR:tgt>`` outputs the full path to the
  199. ``Contents`` directory of macOS Bundles and App Bundles. For all other
  200. bundle types and SDKs it is identical with ``$<TARGET_BUNDLE_DIR:tgt>``.
  201. The new expressions are helpful to query Bundle locations independent of
  202. the different Bundle types and layouts on macOS and iOS.
  203. Deprecated and Removed Features
  204. ===============================
  205. * An explicit deprecation diagnostic was added for policies ``CMP0036``
  206. and below. The :manual:`cmake-policies(7)` manual explains that the
  207. OLD behaviors of all policies are deprecated and that projects should
  208. always port to the NEW behaviors as soon as possible.
  209. * The :generator:`Visual Studio 8 2005` generator is now deprecated
  210. and will be removed in a future version of CMake.
  211. * The :generator:`Visual Studio 7 .NET 2003` generator has been removed.
  212. * The :generator:`Xcode` generator dropped support for Xcode versions
  213. older than 3.
  214. * The :module:`FindDoxygen` module has deprecated several variables.
  215. * The version of curl bundled with CMake no longer accepts URLs of the form
  216. ``file://c:/...`` on Windows due to a change in upstream curl 7.52. Use
  217. the form ``file:///c:/...`` instead to work on all versions.
  218. Other Changes
  219. =============
  220. * When using :prop_tgt:`AUTOMOC`, CMake now scans for the presence of the
  221. ``Q_PLUGIN_METADATA`` macro and reruns moc when the file from the
  222. macro's ``FILE`` argument changes.
  223. * When :prop_tgt:`AUTOMOC` detects an include statement of the form
  224. ``#include "moc_<basename>.cpp"`` the search for the respective header file
  225. now looks in the :prop_tgt:`INCLUDE_DIRECTORIES` of the target as well.
  226. * When running tests, CTest learned to treat skipped tests (using the
  227. :prop_test:`SKIP_RETURN_CODE` property) the same as tests with the new
  228. :prop_test:`DISABLED` property. Due to this change, CTest will not indicate
  229. failure when all tests are either skipped or pass.
  230. * The :generator:`Ninja` generator has loosened the dependencies of object
  231. compilation. Object compilation now depends only on custom targets
  232. and custom commands associated with libraries on which the object's target
  233. depends and no longer depends on the libraries themselves. Source files
  234. in dependent targets may now compile without waiting for their targets'
  235. dependencies to link.
  236. * On macOS, the default application bundle ``Info.plist`` file now enables
  237. Hi-DPI support.
  238. * On macOS, ``RPATH`` settings such as :prop_tgt:`BUILD_WITH_INSTALL_RPATH`
  239. no longer affect the ``install_name`` field. See policy :policy:`CMP0068`.