CMake 3.22.0-rc1 is ready for testing

I am proud to announce the first CMake 3.22 release candidate.
https://cmake.org/download/

Documentation is available at:
https://cmake.org/cmake/help/v3.22

Release notes appear below and are also published at
https://cmake.org/cmake/help/v3.22/release/3.22.html

Some of the more significant changes in CMake 3.22 are:

  • The “Compile Features” functionality now correctly disables or
    enables compiler extensions when no standard level is specified and
    avoids unnecessarily adding language standard flags if the requested
    settings match the compiler’s defaults. See “CMP0128”.

  • The “cmake_host_system_information()” command can now query OS
    identification variables from the “/etc/os-release” file.

  • The “CMAKE_BUILD_TYPE” environment variable was added to provide a
    default value for the “CMAKE_BUILD_TYPE” variable.

  • The “CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>” variable was added to
    turn a non-REQUIRED “find_package()” call into a REQUIRED one.

  • The “FetchContent” module now passes through the “CMAKE_TLS_VERIFY”,
    “CMAKE_TLS_CAINFO”, “CMAKE_NETRC” and “CMAKE_NETRC_FILE” variables
    (when defined) to the underlying “ExternalProject” sub-build.
    Previously, those variables were silently ignored by “FetchContent”.

  • The “Visual Studio 10 2010” generator is now deprecated and will be
    removed in a future version of CMake.

CMake 3.22 Release Notes

Changes made since CMake 3.21 include the following.

New Features

Commands

  • The “cmake_host_system_information()” command can now query OS
    identification variables from the “/etc/os-release” file.

  • The “string(TIMESTAMP)” command now supports the “%V” specifier for
    ISO 8601 week numbers.

Variables

  • The “CMAKE_BUILD_TYPE” environment variable was added to provide a
    default value for the “CMAKE_BUILD_TYPE” variable.

  • The “CMAKE_CONFIGURATION_TYPES” environment variable was added to
    provide a default value for the “CMAKE_CONFIGURATION_TYPES”
    variable.

  • The “CMAKE_INSTALL_MODE” environment variable was added to tell
    “install()” rules (implemented by “file(INSTALL)”) to install
    symbolic links instead of copying of files.

  • The “CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG” and
    “CMAKE_LINK_WHAT_YOU_USE_CHECK” variables were added to control the
    linker flag and check used by the “LINK_WHAT_YOU_USE” target
    property.

  • The “CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>” variable was added to
    turn a non-REQUIRED “find_package()” call into a REQUIRED one.

Properties

  • The “<LANG>_EXTENSIONS” target property is now initialized to
    “CMAKE_<LANG>_EXTENSIONS_DEFAULT”, detected from the compiler. See
    “CMP0128”.

  • The “VS_SETTINGS” source file property is now supported for all
    source file types. Previously it worked only for non-built sources.

Modules

  • The “CMakeDependentOption” module “cmake_dependent_option()” macro
    now supports full Condition Syntax. See policy “CMP0127”.

  • The “FetchContent” module now passes through the “CMAKE_TLS_VERIFY”,
    “CMAKE_TLS_CAINFO”, “CMAKE_NETRC” and “CMAKE_NETRC_FILE” variables
    (when defined) to the underlying “ExternalProject” sub-build.
    Previously, those variables were silently ignored by “FetchContent”.

  • The “FindBLAS” and “FindLAPACK” modules gained a
    “BLA_SIZEOF_INTEGER” option to find a BLAS/LAPACK whose ABI uses a
    specific integer size.

  • The “FindJasper” module now provides an imported target.

  • The “FindMatlab” module now provides imported targets.

  • The “FindPkgConfig” module gained a “PKG_CONFIG_ARGN” variable to
    specify arguments to “pkg-config” calls.

  • The “GoogleTest” module “gtest_discover_tests()” function gained a
    “TEST_FILTER” option to filter tests using “–gtest_filter” during
    test discovery.

  • The “UseSWIG” module, for Visual Studio Generators, can now use the
    “swig” tool to generate implicit dependencies.

CTest

  • “ctest(1)” learned to recognize labels attached to a test at run
    time. Previously it was only possible to attach labels to tests at
    configure time by using the “LABELS” test property. See Additional
    Test Measurements for more information.

  • “ctest(1)” learned to be able to modify the environment for a test
    through the “ENVIRONMENT_MODIFICATION” property. This is allows for
    updates to environment variables based on the environment present at
    test time.

  • The “ctest_memcheck()” command now also generates a
    “DynamicAnalysis-Test.xml” file which may be used to submit test
    results to CDash.

CPack

  • The “CPack DEB Generator” gained the option to set
    “CPACK_DEBIAN_COMPRESSION_TYPE” to “zstd”, which enables Zstandard
    compression for deb packages.

  • The “CPack NSIS Generator” gained a new
    “CPACK_NSIS_IGNORE_LICENSE_PAGE” variable to suppress the license
    page in the installer.

  • The “CPack RPM Generator” gained the
    “CPACK_RPM_REQUIRES_EXCLUDE_FROM” option to avoid scanning specific
    paths for dependencies.

Deprecated and Removed Features

  • The “Visual Studio 10 2010” generator is now deprecated and will be
    removed in a future version of CMake.

Other Changes

  • The “Compile Features” functionality now correctly disables or
    enables compiler extensions when no standard level is specified and
    avoids unnecessarily adding language standard flags if the requested
    settings match the compiler’s defaults. See “CMP0128”.

  • The “Compile Features” functionality now ignores features for
    languages that are not enabled.

  • The Ninja Generators now implement the “edit_cache” target using
    “ccmake(1)” if available.

  • The “Ninja” and “NMake Makefiles” generators now use the MSVC
    “-external:I” flag for system includes. This became available as of
    VS 16.10 (toolchain version 14.29.30037).

  • The “CPack NSIS Generator” now requires NSIS 3.03 or later.

3 Likes

A CMake 3.22 Fortran improvement: configure time is 100+ milliseconds faster, up to a few seconds faster on slower machines, particularly on Windows.

This was accomplished by assuming the Fortran complier is Fortran 90 capable before falling back to Fortran 77 only. https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6250/diffs?commit_id=97e2828d14b7afbf4e22a3ea5b4ecf49f1f7c6f2