3.8.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. CMake 3.8 Release Notes
  2. ***********************
  3. .. only:: html
  4. .. contents::
  5. Changes made since CMake 3.7 include the following.
  6. New Features
  7. ============
  8. Languages
  9. ---------
  10. C#
  11. ^^
  12. * CMake learned to support ``CSharp`` (C#) as a first-class language that
  13. can be enabled via the :command:`project` and :command:`enable_language`
  14. commands. It is currently supported by the :ref:`Visual Studio Generators`
  15. for VS 2010 and above.
  16. C# assemblies and programs can be added just like common C++ targets using
  17. the :command:`add_library` and :command:`add_executable` commands.
  18. References between C# targets in the same source tree may be specified by
  19. :command:`target_link_libraries` like for C++. References to system or
  20. 3rd-party assemblies may be specified by the target properties
  21. :prop_tgt:`VS_DOTNET_REFERENCE_<refname>` and
  22. :prop_tgt:`VS_DOTNET_REFERENCES`.
  23. * More fine tuning of C# targets may be done using target and source
  24. file properties. Specifically the target properties related to
  25. Visual Studio (``VS_*``) are worth a look (for setting toolset
  26. versions, root namespaces, assembly icons, ...).
  27. CUDA
  28. ^^^^
  29. * CMake learned to support ``CUDA`` as a first-class language that can be
  30. enabled via the :command:`project` and :command:`enable_language` commands.
  31. * ``CUDA`` is currently supported by the :ref:`Makefile Generators`
  32. and the :generator:`Ninja` generator on Linux, macOS, and Windows.
  33. Support for the Visual Studio IDE is under development but not
  34. included in this release.
  35. * The NVIDIA CUDA Toolkit compiler (``nvcc``) is supported.
  36. C & C++
  37. ^^^^^^^
  38. * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
  39. now offers meta-features that request compiler modes for specific language
  40. standard levels (e.g. ``cxx_std_11``). See
  41. :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES`.
  42. * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
  43. is now aware of C++ 17. No specific features are yet enumerated besides
  44. the ``cxx_std_17`` meta-feature.
  45. * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
  46. is now aware of the availability of C99 in gcc since version 3.4.
  47. Platforms
  48. ---------
  49. * A new minimal platform file for ``Fuchsia`` was added.
  50. Generators
  51. ----------
  52. * The :generator:`CodeBlocks` extra generator may now be used to
  53. generate with :generator:`NMake Makefiles JOM`.
  54. * The :ref:`Visual Studio Generators` for VS 2013 and above learned to
  55. support a ``host=x64`` option in the :variable:`CMAKE_GENERATOR_TOOLSET`
  56. value (e.g. via the :manual:`cmake(1)` ``-T`` option) to request use
  57. of a VS 64-bit toolchain on 64-bit hosts.
  58. * The :ref:`Visual Studio Generators` learned to treat files passed to
  59. :command:`target_link_libraries` whose names end in ``.targets``
  60. as MSBuild "targets" files to be imported into generated project files.
  61. Commands
  62. --------
  63. * The :command:`add_custom_command` and :command:`add_custom_target` commands
  64. learned the option ``COMMAND_EXPAND_LISTS`` which causes lists in the
  65. ``COMMAND`` argument to be expanded, including lists created by generator
  66. expressions.
  67. * The :command:`execute_process` command gained an ``ENCODING`` option to
  68. specify on Windows which encoding is used for output from child process.
  69. * The :command:`math(EXPR)` command gained support for unary
  70. ``+`` and ``-`` operators.
  71. * The :command:`source_group` command gained ``TREE`` and ``PREFIX``
  72. options to add groups following source tree directory structure.
  73. * The :command:`string(TIMESTAMP)` command learned to treat ``%%``
  74. as a way to encode plain ``%``.
  75. * The :command:`string(TIMESTAMP)` command will now honor the
  76. ``SOURCE_DATE_EPOCH`` environment variable and use its value
  77. instead of the current time.
  78. * The :command:`try_compile` command source file signature gained new options
  79. to specify the language standard to use in the generated test project.
  80. * The :command:`try_compile` command source file signature now honors
  81. language standard variables like :variable:`CMAKE_CXX_STANDARD`.
  82. See policy :policy:`CMP0067`.
  83. Variables
  84. ---------
  85. * A :variable:`CMAKE_CODELITE_USE_TARGETS` variable was added to tell the
  86. :generator:`CodeLite` extra generator to change the generated project
  87. to have target-centric organization.
  88. The ``build``, ``rebuild``, and ``clean`` operations within ``CodeLite``
  89. then work on a selected target rather than the whole workspace.
  90. (Note that the :generator:`Ninja` clean operation on a target
  91. includes its dependencies, though.)
  92. * The :variable:`CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS` variable was added to
  93. tell the :generator:`Sublime Text 2` extra generator to place specified
  94. environment variables in the generated ``.sublime-project``.
  95. * The :variable:`CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE` variable was added
  96. to tell the :generator:`Sublime Text 2` extra generator whether to exclude
  97. the build tree from the ``.sublime-project`` when it is inside the source
  98. tree.
  99. * A :variable:`CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD` variable was
  100. added to tell :ref:`Visual Studio Generators` for VS 2010 and above
  101. to include the ``PACKAGE`` target in the default build, similar to
  102. the existing :variable:`CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD`
  103. variable for the ``INSTALL`` target.
  104. Properties
  105. ----------
  106. * A :prop_tgt:`BUILD_RPATH` target property and corresponding
  107. :variable:`CMAKE_BUILD_RPATH` variable were added to support custom
  108. ``RPATH`` locations to be added to binaries in the build tree.
  109. * The :prop_sf:`COMPILE_FLAGS` source file property learned to support
  110. :manual:`generator expressions <cmake-generator-expressions(7)>`.
  111. * The :prop_tgt:`FRAMEWORK` target property may now also be applied to
  112. static libraries on Apple targets. It will result in a proper
  113. Framework but with a static library inside.
  114. * :ref:`Imported <Imported Targets>` :ref:`Interface Libraries` learned new
  115. :prop_tgt:`IMPORTED_LIBNAME` and :prop_tgt:`IMPORTED_LIBNAME_<CONFIG>`
  116. target properties to specify a link library name since interface libraries
  117. do not build their own library files.
  118. * A :prop_tgt:`<LANG>_CPPLINT` target property and supporting
  119. :variable:`CMAKE_<LANG>_CPPLINT` variable were introduced to tell
  120. the :ref:`Makefile Generators` and the :generator:`Ninja` generator to
  121. run the ``cpplint`` style checker along with the compiler for ``C`` and
  122. ``CXX`` languages.
  123. * A :prop_tgt:`MANUALLY_ADDED_DEPENDENCIES` target property has been added.
  124. It provides a read-only list of dependencies that have been added with
  125. the :command:`add_dependencies` command.
  126. * The :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property learned
  127. to interpret empty list elements as referring to the configuration-less
  128. imported location specified by :prop_tgt:`IMPORTED_LOCATION`.
  129. * The :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property is now supported
  130. on :ref:`Imported <Imported Targets>` :ref:`Interface Libraries`.
  131. * New source file properties :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC`,
  132. :prop_sf:`SKIP_AUTORCC`, and :prop_sf:`SKIP_AUTOGEN` were added to allow
  133. source files to be excluded from processing by :prop_tgt:`AUTOMOC`,
  134. :prop_tgt:`AUTOUIC`, and :prop_tgt:`AUTORCC` target properties.
  135. * A :prop_sf:`VS_COPY_TO_OUT_DIR` source file property was added to
  136. tell :ref:`Visual Studio Generators` for VS 2010 and above whether
  137. or not a file should e copied to the output directory.
  138. * A :prop_tgt:`VS_DEBUGGER_WORKING_DIRECTORY` target property was added
  139. to tell :ref:`Visual Studio Generators` for VS 2010 and above what
  140. debugger working directory should be set for the target.
  141. * A :prop_tgt:`VS_DOTNET_REFERENCES_COPY_LOCAL` target property was added
  142. to specify whether to copy referenced assemblies to the output directory.
  143. * A :prop_tgt:`VS_DOTNET_REFERENCE_<refname>` target property was added
  144. to tell :ref:`Visual Studio Generators` for VS 2010 and above to add
  145. a .NET reference with a given hint path.
  146. * A :prop_sf:`VS_INCLUDE_IN_VSIX` source file property was added to
  147. tell :ref:`Visual Studio Generators` for VS 2010 and above whether
  148. to include the file in a Visual Studio extension package.
  149. * A :prop_sf:`VS_RESOURCE_GENERATOR` source file property was added to
  150. give :ref:`Visual Studio Generators` for VS 2010 and above a setting
  151. for the resource generator (``C#`` only).
  152. * A :prop_tgt:`VS_USER_PROPS` target property was added to tell
  153. :ref:`Visual Studio Generators` for VS 2010 and above to use a
  154. custom MSBuild user ``.props`` file.
  155. * A :prop_gbl:`XCODE_EMIT_EFFECTIVE_PLATFORM_NAME` global property was
  156. added to tell the :generator:`Xcode` generator whether to emit the
  157. ``EFFECTIVE_PLATFORM_NAME`` variable. This is useful when building
  158. with multiple SDKs like ``macosx`` and ``iphoneos`` in parallel.
  159. * New :prop_tgt:`XCODE_PRODUCT_TYPE` and :prop_tgt:`XCODE_EXPLICIT_FILE_TYPE`
  160. target properties were created to tell the :generator:`Xcode` generator
  161. to use custom values of the corresponding attributes for a target in the
  162. generated Xcode project.
  163. Modules
  164. -------
  165. * A :module:`CSharpUtilities` module was added to aid parameterization of
  166. Visual Studio C# targets. It provides functions to allow automated
  167. setting of source file properties to support Windows Forms, WPF/XAML or
  168. other technologies as needed.
  169. * The :module:`ExternalData` module learned to support multiple
  170. content links for one data file using different hashes, e.g.
  171. ``img.png.sha256`` and ``img.png.sha1``. This allows objects
  172. to be fetched from sources indexed by different hash algorithms.
  173. * The :module:`ExternalProject` module gained the ``GIT_PROGRESS`` option to
  174. force Git to show progress when cloning repositories.
  175. * The :module:`ExternalProject` module gained a ``GIT_CONFIG`` option
  176. to pass ``--config`` options to Git when cloning repositories.
  177. * The :module:`FeatureSummary` module :command:`feature_summary` command now
  178. accepts a new ``QUIET_ON_EMPTY`` option that suppresses the output when
  179. the list of packages that belong to the selected category is empty.
  180. * The :module:`FeatureSummary` module :command:`add_feature_info` command
  181. now accepts lists of dependencies for deciding whether a feature is enabled
  182. or not.
  183. * The package types accepted by the :module:`FeatureSummary` module can now
  184. be tweaked by changing the :variable:`FeatureSummary_PKG_TYPES`,
  185. :variable:`FeatureSummary_REQUIRED_PKG_TYPES` and
  186. :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global properties.
  187. * The :module:`FindOpenGL` module now provides imported targets
  188. ``OpenGL::GL`` and ``OpenGL::GLU`` when the libraries are found.
  189. * The :module:`UseSWIG` module gained a ``swig_add_library`` command
  190. to give more flexibility over the old ``swig_add_module`` command.
  191. * The :module:`UseSWIG` module ``swig_add_source_to_module`` command
  192. learned a new ``SWIG_OUTFILE_DIR`` option to control the output
  193. file location (``swig -o``).
  194. * The :module:`WriteCompilerDetectionHeader` module gained the
  195. ``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` options
  196. that allow creation of headers that will work also with unknown or old
  197. compilers by simply assuming they do not support any of the requested
  198. features.
  199. CTest
  200. -----
  201. * The :command:`ctest_memcheck` command gained a ``DEFECT_COUNT <var>``
  202. option to capture the number of memory defects detected.
  203. * The :command:`ctest_memcheck` command learned to read the location of
  204. suppressions files for sanitizers from the
  205. :variable:`CTEST_MEMORYCHECK_SUPPRESSIONS_FILE` variable.
  206. * The :command:`ctest_memcheck` command learned to support ``LeakSanitizer``
  207. independently from ``AddressSanitizer``.
  208. * The :command:`ctest_update` command ``CDASH_UPLOAD`` signature was taught
  209. to honor the ``RETRY_COUNT``, ``RETRY_DELAY``, and ``QUIET`` options.
  210. CPack
  211. -----
  212. * The :module:`CPackIFWConfigureFile` module was added to define a new
  213. :command:`cpack_ifw_configure_file` command to configure file templates
  214. prepared in QtIFW/SDK/Creator style.
  215. * The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
  216. :command:`cpack_ifw_configure_component_group` commands gained a new
  217. ``DEFAULT``, ``VIRTUAL``, ``FORCED_INSTALLATION``, ``REQUIRES_ADMIN_RIGHTS``,
  218. ``DISPLAY_NAME``, ``UPDATE_TEXT``, ``DESCRIPTION``, ``RELEASE_DATE``,
  219. ``AUTO_DEPEND_ON`` and ``TRANSLATIONS`` options to more specific
  220. configuration.
  221. * The :module:`CPackIFW` module :command:`cpack_ifw_configure_component`
  222. command gained a new ``DEPENDENCIES`` alias for ``DEPENDS`` option.
  223. * The :module:`CPackIFW` module :command:`cpack_ifw_configure_component_group`
  224. command gained a new ``DEPENDS`` option. The ``DEPENDENCIES`` alias also
  225. added.
  226. * The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
  227. :command:`cpack_ifw_configure_component_group` commands ``PRIORITY``
  228. option now is deprecated and will be removed in a future version of CMake.
  229. Please use new ``SORTING_PRIORITY`` option instead.
  230. * The :module:`CPackIFW` module gained new
  231. :variable:`CPACK_IFW_PACKAGE_WATERMARK`,
  232. :variable:`CPACK_IFW_PACKAGE_BANNER`,
  233. :variable:`CPACK_IFW_PACKAGE_BACKGROUND`,
  234. :variable:`CPACK_IFW_PACKAGE_WIZARD_STYLE`,
  235. :variable:`CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH`,
  236. :variable:`CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT`, and
  237. :variable:`CPACK_IFW_PACKAGE_TITLE_COLOR`
  238. variables to customize a QtIFW installer look.
  239. * The :module:`CPackProductBuild` module gained options to sign packages.
  240. See the variables :variable:`CPACK_PRODUCTBUILD_IDENTITY_NAME`,
  241. :variable:`CPACK_PRODUCTBUILD_KEYCHAIN_PATH`,
  242. :variable:`CPACK_PKGBUILD_IDENTITY_NAME`, and
  243. :variable:`CPACK_PKGBUILD_KEYCHAIN_PATH`.
  244. * The :module:`CPackRPM` module learned to omit tags that are not supported by
  245. provided ``rpmbuild`` tool. If unsupported tags are set they are ignored
  246. and a developer warning is printed out.
  247. * The :module:`CPackRPM` module learned to generate main component package
  248. which forces generation of a rpm for defined component without component
  249. suffix in filename and package name.
  250. See :variable:`CPACK_RPM_MAIN_COMPONENT` variable.
  251. * The :module:`CPackRPM` module learned to generate a single ``debuginfo``
  252. package on demand even if components packaging is used.
  253. See :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` variable.
  254. * The :module:`CPackRPM` module learned to support
  255. multiple directives per file when using
  256. :variable:`CPACK_RPM_USER_FILELIST` variable.
  257. Other
  258. -----
  259. * CMake functionality using cryptographic hashes now supports SHA-3 algorithms.
  260. * A new generator expression ``$<IF:cond,true-value,false-value>`` was added.
  261. It resolves to the true-value if the condition is ``1`` and resolves to
  262. the false-value if the condition is ``0``.
  263. Deprecated and Removed Features
  264. ===============================
  265. * The :module:`FeatureSummary` module commands :command:`set_package_info`,
  266. :command:`set_feature_info`, :command:`print_enabled_features`, and
  267. :command:`print_disabled_features` are now deprecated.
  268. * The :module:`UseSWIG` module ``swig_add_module`` command is now
  269. deprecated in favor of ``swig_add_library``.
  270. Other Changes
  271. =============
  272. * If a command specified by the :prop_tgt:`<LANG>_CLANG_TIDY` target property
  273. returns non-zero at build time this is now treated as an error instead of
  274. silently ignored.
  275. * The :command:`ctest_memcheck` command no longer automatically adds
  276. ``leak_check=1`` to the options used by ``AddressSanitizer``. The default
  277. behavior of ``AddressSanitizer`` is to run `LeakSanitizer` to check leaks
  278. unless ``leak_check=0``.
  279. * The :command:`ctest_memcheck` command was fixed to correctly append extra
  280. sanitizer options read from the
  281. :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS` variable to the environment
  282. variables used internally by the sanitizers.
  283. * The :module:`FeatureSummary` module :command:`set_package_properties`
  284. command no longer forces the package type to ``OPTIONAL`` when the type
  285. is not explicitly set.
  286. * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
  287. is now aware of features supported by Intel C++ compilers versions 12.1
  288. through 17.0 on UNIX and Windows platforms.
  289. * Calls to the :module:`FindPkgConfig` module :command:`pkg_check_modules`
  290. command following a successful call learned to re-evaluate the cached values
  291. for a given prefix after changes to the parameters to the command for that
  292. prefix.
  293. * When using :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC`, generated
  294. ``moc_*``, ``*.moc`` and ``ui_*`` are placed in the
  295. ``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which
  296. is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
  297. It is therefore not necessary anymore to have
  298. :variable:`CMAKE_CURRENT_BINARY_DIR` in the target's
  299. :prop_tgt:`INCLUDE_DIRECTORIES`.
  300. * The :generator:`Sublime Text 2` generator no longer runs the native
  301. build command (e.g. ``ninja`` or ``make``) with verbose build output
  302. enabled.
  303. * The :command:`try_compile` command source file signature now
  304. honors the :variable:`CMAKE_WARN_DEPRECATED` variable value
  305. in the generated test project.
  306. * The :ref:`Visual Studio Generators` for VS 2010 and above now place
  307. per-source file flags after target-wide flags when they are classified
  308. as raw flags with no project file setting (``AdditionalOptions``).
  309. This behavior is more consistent with the ordering of flags produced
  310. by other generators, and allows flags on more-specific properties
  311. (per-source) to override those on more general ones (per-target).
  312. * The precompiled Windows binary MSI package provided on ``cmake.org`` now
  313. records the installation directory in the Windows Registry under the key
  314. ``HKLM\Software\Kitware\CMake`` with a value named ``InstallDir``.