CMake 3.8 Release Notes

Changes made since CMake 3.7 include the following.

New Features

Languages

C#

  • CMake learned to support CSharp (C#) as a first-class language that can be enabled via the project() and enable_language() commands. It is currently supported by the Visual Studio Generators for VS 2010 and above.

    C# assemblies and programs can be added just like common C++ targets using the add_library() and add_executable() commands. References between C# targets in the same source tree may be specified by target_link_libraries() like for C++. References to system or 3rd-party assemblies may be specified by the target properties VS_DOTNET_REFERENCE_<refname> and VS_DOTNET_REFERENCES.

  • More fine tuning of C# targets may be done using target and source file properties. Specifically the target properties related to Visual Studio (VS_*) are worth a look (for setting toolset versions, root namespaces, assembly icons, …).

CUDA

  • CMake learned to support CUDA as a first-class language that can be enabled via the project() and enable_language() commands.

  • CUDA is currently supported by the Makefile Generators and the Ninja generator on Linux, macOS, and Windows. Support for the Visual Studio IDE is under development but not included in this release.

  • The NVIDIA CUDA Toolkit compiler (nvcc) is supported.

C & C++

Platforms

  • A new minimal platform file for Fuchsia was added.

Generators

Commands

  • The add_custom_command() and add_custom_target() commands learned the option COMMAND_EXPAND_LISTS which causes lists in the COMMAND argument to be expanded, including lists created by generator expressions.

  • The execute_process() command gained an ENCODING option to specify on Windows which encoding is used for output from child process.

  • The math(EXPR) command gained support for unary + and - operators.

  • The source_group() command gained TREE and PREFIX options to add groups following source tree directory structure.

  • The string(TIMESTAMP) command learned to treat %% as a way to encode plain %.

  • The string(TIMESTAMP) command will now honor the SOURCE_DATE_EPOCH environment variable and use its value instead of the current time.

  • The try_compile() command source file signature gained new options to specify the language standard to use in the generated test project.

  • The try_compile() command source file signature now honors language standard variables like CMAKE_CXX_STANDARD. See policy CMP0067.

Variables

Properties

Modules

  • A CSharpUtilities module was added to aid parameterization of Visual Studio C# targets. It provides functions to allow automated setting of source file properties to support Windows Forms, WPF/XAML or other technologies as needed.

  • The ExternalData module learned to support multiple content links for one data file using different hashes, e.g. img.png.sha256 and img.png.sha1. This allows objects to be fetched from sources indexed by different hash algorithms.

  • The ExternalProject module gained the GIT_PROGRESS option to force Git to show progress when cloning repositories.

  • The ExternalProject module gained a GIT_CONFIG option to pass --config options to Git when cloning repositories.

  • The FeatureSummary module feature_summary() command now accepts a new QUIET_ON_EMPTY option that suppresses the output when the list of packages that belong to the selected category is empty.

  • The FeatureSummary module add_feature_info() command now accepts lists of dependencies for deciding whether a feature is enabled or not.

  • The package types accepted by the FeatureSummary module can now be tweaked by changing the FeatureSummary_PKG_TYPES, FeatureSummary_REQUIRED_PKG_TYPES and FeatureSummary_DEFAULT_PKG_TYPE global properties.

  • The FindOpenGL module now provides imported targets OpenGL::GL and OpenGL::GLU when the libraries are found.

  • The UseSWIG module gained a swig_add_library command to give more flexibility over the old swig_add_module command.

  • The UseSWIG module swig_add_source_to_module command learned a new SWIG_OUTFILE_DIR option to control the output file location (swig -o).

  • The WriteCompilerDetectionHeader module gained the ALLOW_UNKNOWN_COMPILERS and ALLOW_UNKNOWN_COMPILER_VERSIONS options that allow creation of headers that will work also with unknown or old compilers by simply assuming they do not support any of the requested features.

CTest

CPack

Other

  • CMake functionality using cryptographic hashes now supports SHA-3 algorithms.

  • A new generator expression $<IF:cond,true-value,false-value> was added. It resolves to the true-value if the condition is 1 and resolves to the false-value if the condition is 0.

Deprecated and Removed Features

Other Changes

  • If a command specified by the <LANG>_CLANG_TIDY target property returns non-zero at build time this is now treated as an error instead of silently ignored.

  • The ctest_memcheck() command no longer automatically adds leak_check=1 to the options used by AddressSanitizer. The default behavior of AddressSanitizer is to run LeakSanitizer to check leaks unless leak_check=0.

  • The ctest_memcheck() command was fixed to correctly append extra sanitizer options read from the CTEST_MEMORYCHECK_SANITIZER_OPTIONS variable to the environment variables used internally by the sanitizers.

  • The FeatureSummary module set_package_properties() command no longer forces the package type to OPTIONAL when the type is not explicitly set.

  • The Compile Features functionality is now aware of features supported by Intel C++ compilers versions 12.1 through 17.0 on UNIX and Windows platforms.

  • Calls to the FindPkgConfig module pkg_check_modules() command following a successful call learned to re-evaluate the cached values for a given prefix after changes to the parameters to the command for that prefix.

  • When using AUTOMOC or AUTOUIC, generated moc_*, *.moc and ui_* are placed in the <CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include directory which is automatically added to the target’s INCLUDE_DIRECTORIES. It is therefore not necessary anymore to have CMAKE_CURRENT_BINARY_DIR in the target’s INCLUDE_DIRECTORIES.

  • The Sublime Text 2 generator no longer runs the native build command (e.g. ninja or make) with verbose build output enabled.

  • The try_compile() command source file signature now honors the CMAKE_WARN_DEPRECATED variable value in the generated test project.

  • The Visual Studio Generators for VS 2010 and above now place per-source file flags after target-wide flags when they are classified as raw flags with no project file setting (AdditionalOptions). This behavior is more consistent with the ordering of flags produced by other generators, and allows flags on more-specific properties (per-source) to override those on more general ones (per-target).

  • The precompiled Windows binary MSI package provided on cmake.org now records the installation directory in the Windows Registry under the key HKLM\Software\Kitware\CMake with a value named InstallDir.