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