CMake 3.9 Release Notes

Changes made since CMake 3.8 include the following.

New Features

Languages

Generators

  • Visual Studio Generators for VS 2010 and above learned to support the ASM_NASM language when nasm is installed.
  • The Xcode generator learned to create Xcode schema files. This is an experimental feature and can be activated by setting the CMAKE_XCODE_GENERATE_SCHEME variable to a TRUE value.
  • The Xcode generator now supports Xcode 9.

Commands

Variables

Properties

Modules

  • A CheckIPOSupported module was added to help projects check whether interprocedural optimization (IPO) is supported by the current toolchain and CMake version.
  • The CMakeFindDependencyMacro module find_dependency macro now forwards all arguments to the underlying find_package() call. Existing uses will continue to function as before, but callers can now access the full suite of arguments that find_package accepts.
  • The FeatureSummary module feature_summary() command now accepts the new DEFAULT_DESCRIPTION option that will print the default title for the selected package type.
  • The FeatureSummary module gained a new FeatureSummary_<TYPE>_DESCRIPTION variable that can be defined for each <TYPE> to replace the type name with the specified string whenever the package type is used in an output string by the module.
  • The FindDoxygen module learned to control Doxygen behavior using CMake variables and generate documentation via the newly added doxygen_add_docs() function. The Doxygen input file (Doxyfile) is automatically generated and doxygen is run as part of a custom target. Additional components can be specified to find optional tools: dot, mscgen and dia.
  • The FindMPI module now provides imported targets.
  • The FindProtobuf module protobuf_generate_cpp() command gained an EXPORT_MACRO option to specify the name of a DLL export markup macro.
  • The FindProtobuf module now supports usage of static libraries for Unix via a new Protobuf_USE_STATIC_LIBS input variable.
  • The FindProtobuf module now provides imported targets when the libraries are found.
  • A new GoogleTest module was added to provide the gtest_add_tests() function independently of the FindGTest module. The function was also updated to support keyword arguments, with functionality expanded to allow a test name prefix and suffix to be specified, the dependency on the source files to be optional and the list of discovered test cases to be returned to the caller.

CTest

  • The ctest_submit() command gained a HTTPHEADER option to specify custom headers to send during submission.
  • The ctest(1) executable gained new options which allow the developer to disable automatically adding tests to the test set to satisfy fixture dependencies. -FS prevents adding setup tests for fixtures matching the provided regular expression, -FC prevents adding cleanup tests for matching fixtures and -FA prevents adding any test for matching fixtures.
  • A DISABLED test property was added to mark tests that are configured but explicitly disabled so they do not run.

CPack

Other

  • Interprocedural optimization (IPO) is now supported for GNU and Clang compilers using link time optimization (LTO) flags. See the INTERPROCEDURAL_OPTIMIZATION target property and CheckIPOSupported module.
  • The TARGET_OBJECTS generator expression is now supported by the add_custom_command() and file(GENERATE) commands.
  • Two new informational generator expressions to retrieve Apple Bundle directories have been added. The first one $<TARGET_BUNDLE_DIR:tgt> outputs the full path to the Bundle directory, the other one $<TARGET_BUNDLE_CONTENT_DIR:tgt> outputs the full path to the Contents directory of macOS Bundles and App Bundles. For all other bundle types and SDKs it is identical with $<TARGET_BUNDLE_DIR:tgt>. The new expressions are helpful to query Bundle locations independent of the different Bundle types and layouts on macOS and iOS.

Deprecated and Removed Features

  • An explicit deprecation diagnostic was added for policies CMP0036 and below. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that projects should always port to the NEW behaviors as soon as possible.
  • The Visual Studio 8 2005 generator is now deprecated and will be removed in a future version of CMake.
  • The Visual Studio 7 .NET 2003 generator has been removed.
  • The Xcode generator dropped support for Xcode versions older than 3.
  • The FindDoxygen module has deprecated several variables.
  • The version of curl bundled with CMake no longer accepts URLs of the form file://c:/... on Windows due to a change in upstream curl 7.52. Use the form file:///c:/... instead to work on all versions.

Other Changes

  • When using AUTOMOC, CMake now scans for the presence of the Q_PLUGIN_METADATA macro and reruns moc when the file from the macro’s FILE argument changes.
  • When AUTOMOC detects an include statement of the form #include "moc_<basename>.cpp" the search for the respective header file now looks in the INCLUDE_DIRECTORIES of the target as well.
  • When running tests, CTest learned to treat skipped tests (using the SKIP_RETURN_CODE property) the same as tests with the new DISABLED property. Due to this change, CTest will not indicate failure when all tests are either skipped or pass.
  • The Ninja generator has loosened the dependencies of object compilation. Object compilation now depends only on custom targets and custom commands associated with libraries on which the object’s target depends and no longer depends on the libraries themselves. Source files in dependent targets may now compile without waiting for their targets’ dependencies to link.
  • On macOS, the default application bundle Info.plist file now enables Hi-DPI support.
  • On macOS, RPATH settings such as BUILD_WITH_INSTALL_RPATH no longer affect the install_name field. See policy CMP0068.
  • The Visual Studio 14 2015 generator has been taught about a change to the v140 toolset made by a VS 2015 update. VS changed the set of values it understands for the GenerateDebugInformation linker setting that produces the -DEBUG linker flag variants.

Updates

Changes made since CMake 3.9.0 include the following.

3.9.1

  • The find_ command PACKAGE_ROOT search path group added by CMake 3.9.0 has been removed for the 3.9 series due to regressions caused by new use of <PackageName>_ROOT variables. The behavior may be re-introduced in the future in a more-compatible way.