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-releasefile.The
string(TIMESTAMP)command now supports the%Vspecifier for ISO 8601 week numbers.
Variables¶
The
CMAKE_BUILD_TYPEenvironment variable was added to provide a default value for theCMAKE_BUILD_TYPEvariable.The
CMAKE_CONFIGURATION_TYPESenvironment variable was added to provide a default value for theCMAKE_CONFIGURATION_TYPESvariable.The
CMAKE_INSTALL_MODEenvironment variable was added to tellinstall()rules (implemented byfile(INSTALL)) to install symbolic links instead of copying of files.The
CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAGandCMAKE_LINK_WHAT_YOU_USE_CHECKvariables were added to control the linker flag and check used by theLINK_WHAT_YOU_USEtarget property.The
CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>variable was added to turn a non-REQUIREDfind_package()call into a REQUIRED one.
Properties¶
The
<LANG>_EXTENSIONStarget property is now initialized toCMAKE_<LANG>_EXTENSIONS_DEFAULT, detected from the compiler. SeeCMP0128.The
VS_SETTINGSsource file property is now supported for all source file types. Previously it worked only for non-built sources.
Modules¶
The
CMakeDependentOptionmodulecmake_dependent_option()macro now supports full Condition Syntax. See policyCMP0127.The
FetchContentmodule now passes through theCMAKE_TLS_VERIFY,CMAKE_TLS_CAINFO,CMAKE_NETRCandCMAKE_NETRC_FILEvariables (when defined) to the underlyingExternalProjectsub-build. Previously, those variables were silently ignored byFetchContent.The
FindBLASandFindLAPACKmodules gained aBLA_SIZEOF_INTEGERoption to find a BLAS/LAPACK whose ABI uses a specific integer size.The
FindJaspermodule now provides an imported target.The
FindMatlabmodule now provides imported targets.The
FindPkgConfigmodule gained aPKG_CONFIG_ARGNvariable to specify arguments topkg-configcalls.The
GoogleTestmodulegtest_discover_tests()function gained aTEST_FILTERoption to filter tests using--gtest_filterduring test discovery.The
UseSWIGmodule, for Visual Studio Generators, can now use theswigtool 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 theLABELStest property. See Additional Test Measurements for more information.ctest(1)learned to be able to modify the environment for a test through theENVIRONMENT_MODIFICATIONproperty. This is allows for updates to environment variables based on the environment present at test time.The
ctest_memcheck()command now also generates aDynamicAnalysis-Test.xmlfile which may be used to submit test results to CDash.
CPack¶
The
CPack DEB Generatorgained the option to setCPACK_DEBIAN_COMPRESSION_TYPEtozstd, which enables Zstandard compression for deb packages.The
CPack NSIS Generatorgained a newCPACK_NSIS_IGNORE_LICENSE_PAGEvariable to suppress the license page in the installer.The
CPack RPM Generatorgained theCPACK_RPM_REQUIRES_EXCLUDE_FROMoption to avoid scanning specific paths for dependencies.
Deprecated and Removed Features¶
The
Visual Studio 10 2010generator is now deprecated and will be removed in a future version of CMake.
Other Changes¶
The
Compile Featuresfunctionality 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. SeeCMP0128.The
Compile Featuresfunctionality now ignores features for languages that are not enabled.The Ninja Generators now implement the
edit_cachetarget usingccmake(1)if available.The
NinjaandNMake Makefilesgenerators now use the MSVC-external:Iflag for system includes. This became available as of VS 16.10 (toolchain version 14.29.30037).The
CPack NSIS Generatornow requires NSIS 3.03 or later.
Updates¶
Changes made since CMake 3.22.0 include the following.
3.22.1¶
This version made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions.
3.22.2¶
The
OLDbehavior ofCMP0128was fixed to add flags even when the specified standard matches the compiler default.
3.22.3¶
The
while()command again ignores errors in condition evaluation as CMake 3.21 and below did. This bug was fixed in 3.22.0, but exposed errors in existing projects. The fix has been reverted to restore compatibility. The fix may be restored in a future version of CMake via a policy.
3.22.4¶
This version made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions.