CMake 3.21 Release Notes

Changes made since CMake 3.20 include the following.

New Features





  • cmake(1) gained the --install-prefix <dir> command-line option to specify the location of the install prefix.

  • cmake(1) gained the --toolchain <path/to/file> command-line option to specify a toolchain file.

  • cmake(1) -E capabilities output, for some generators, may now contain a supportedPlatforms field listing platforms known to be supported in CMAKE_GENERATOR_PLATFORM.

  • Messages printed to a terminal now may be colored by message type.


  • The Fujitsu compiler is now supported using compiler id Fujitsu in traditional (Trad) mode, and compiler id FujitsuClang in Clang mode.


  • CMake now supports the MSYS runtime environment, much like CYGWIN.

File-Based API

  • The cmake-file-api(7) "codemodel" version 2 version field has been updated to 2.3.

  • The cmake-file-api(7) "codemodel" version 2 gained a new "directory" object containing directory-level information. This includes a list of installers generated by the install() command.





  • The FindBLAS and FindLAPACK modules learned to support the serial Fujitsu_SSL2 and parallel Fujitsu_SSL2BLAMP libraries.

  • The FindDevIL module now provides imported targets.

  • The FindIconv module now has version support.

  • The FindIntl module now has version support.

  • The FindMPI module learned to support Fujitsu and FujitsuClang in both host and cross compiling modes.

  • The FindMsys module was added to find MSYS installations. Like FindCygwin, it is used automatically by some other find modules to locate UNIX-style tools on Windows.

  • The FindOpenMP module learned to support Fujitsu and FujitsuClang.

  • The FindVulkan module gained imported targets Vulkan::Headers and Vulkan::glslangValidator.

  • The UseJava module command add_jar gained a RESOURCES option to allow explicit naming of resources with non-optional namespace.

  • The UseSWIG module use now standard library naming conventions for the CSharp language. See policy CMP0122.

  • The UseSWIG module now supports using the swig tool to generate implicit dependencies with the Xcode generator.

Generator Expressions



Deprecated and Removed Features

  • Undocumented CMAKE_SYSTEM_NAME version-stripping behavior has been removed entirely. If it is set by a -D flag or by a toolchain file, it is left unaltered, even if it still contains a version number. Similar CMAKE_HOST_SYSTEM_NAME version-stripping behavior, also undocumented, has been moved earlier, before project() or enable_language() is called.

  • ARMClang cpu/arch compile and link flags are no longer added automatically based on the CMAKE_SYSTEM_PROCESSOR variable or the undocumented CMAKE_SYSTEM_ARCH variable. They must be specified explicitly. See policy CMP0123.

Other Changes


Changes made since CMake 3.21.0 include the following.


  • The Visual Studio 17 2022 generator is now based on "Visual Studio 2022 Preview 2". Previously it was based on "Preview 1.1".



  • The Visual Studio 17 2022 generator is now based on "Visual Studio 2022 Preview 4". Previously it was based on "Preview 3.1".

  • The AMD ROCm Platform hipcc compiler was identifed by CMake 3.21.0 through 3.21.2 as a distinct compiler with id ROCMClang. This has been removed because it caused regressions. Instead:

    • hipcc may no longer be used as a HIP compiler because it interferes with flags CMake needs to pass to Clang. Use Clang directly.

    • hipcc may once again be used as a CXX compiler, and is treated as whatever compiler it selects underneath, as CMake 3.20 and below did.


  • The Visual Studio 17 2022 generator is now based on the "Visual Studio 2022" release candidates. Previously it was based on preview versions.