3.9.rst 14 KB

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