3.9.rst 14 KB

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