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 theCMAKE_BUILD_TYPE
variable.The
CMAKE_CONFIGURATION_TYPES
environment variable was added to provide a default value for theCMAKE_CONFIGURATION_TYPES
variable.The
CMAKE_INSTALL_MODE
environment 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_FLAG
andCMAKE_LINK_WHAT_YOU_USE_CHECK
variables were added to control the linker flag and check used by theLINK_WHAT_YOU_USE
target property.The
CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>
variable was added to turn a non-REQUIREDfind_package()
call into a REQUIRED one.
Properties¶
The
<LANG>_EXTENSIONS
target property is now initialized toCMAKE_<LANG>_EXTENSIONS_DEFAULT
, detected from the compiler. SeeCMP0128
.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
modulecmake_dependent_option()
macro now supports full Condition Syntax. See policyCMP0127
.The
FetchContent
module now passes through theCMAKE_TLS_VERIFY
,CMAKE_TLS_CAINFO
,CMAKE_NETRC
andCMAKE_NETRC_FILE
variables (when defined) to the underlyingExternalProject
sub-build. Previously, those variables were silently ignored byFetchContent
.The
FindBLAS
andFindLAPACK
modules gained aBLA_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 aPKG_CONFIG_ARGN
variable to specify arguments topkg-config
calls.The
GoogleTest
modulegtest_discover_tests()
function gained aTEST_FILTER
option to filter tests using--gtest_filter
during test discovery.The
UseSWIG
module, for Visual Studio Generators, can now use theswig
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 theLABELS
test property. See Additional Test Measurements for more information.ctest(1)
learned to be able to modify the environment for a test through theENVIRONMENT_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 aDynamicAnalysis-Test.xml
file which may be used to submit test results to CDash.
CPack¶
The
CPack DEB Generator
gained the option to setCPACK_DEBIAN_COMPRESSION_TYPE
tozstd
, which enables Zstandard compression for deb packages.The
CPack NSIS Generator
gained a newCPACK_NSIS_IGNORE_LICENSE_PAGE
variable to suppress the license page in the installer.The
CPack RPM Generator
gained theCPACK_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. SeeCMP0128
.The
Compile Features
functionality now ignores features for languages that are not enabled.The Ninja Generators now implement the
edit_cache
target usingccmake(1)
if available.The
Ninja
andNMake 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.
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
OLD
behavior ofCMP0128
was 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, 3.22.5, 3.22.6¶
These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions.