CMake 3.31 Release Notes¶
Changes made since CMake 3.30 include the following.
New Features¶
Presets¶
- cmake-presets(7)files may now include comments using the key- $commentat any level within the JSON object to provide documentation.
- cmake-presets(7)files may now request graphviz output using the- graphvizkey in a configure preset.
Generators¶
- The Ninja Generators and Makefile Generators now produce a - codegenbuild target. See policy- CMP0171. It drives a subset of the build graph sufficient to run custom commands created with- add_custom_command()'s new- CODEGENoption.
Command-Line¶
- The - cmake --workflowmode now accepts a preset name as the first argument, allowing the simpler command line- cmake --workflow <preset>.
- The - cmake -LR[A][H]option was added to list cache entries whose names match a regular expression.
Compilers¶
- The LFortran compiler is now supported with - compiler id- LFortran.
Commands¶
- The - add_custom_command()command gained a- CODEGENoption to mark a custom command's outputs as dependencies of a- codegentarget. See policy- CMP0171.
- The - cmake_pkg_config()command was added as an endpoint for using CMake's native pkg-config format parser. The only supported option in this release is- EXTRACT, which provides low-level access to the values produced by parsing a pkg-config file. For most users, this is not yet a suitable replacement for the- FindPkgConfigmodule.
- The - file(ARCHIVE_CREATE)command gained a- WORKING_DIRECTORYoption to specify a working directory for the archiving process.
- The - file(MAKE_DIRECTORY)command gained a- RESULToption to capture failure in a result variable.
- The - install(FILES)and- install(DIRECTORY)commands'- TYPEargument gained support for a- LIBEXECtype.
Variables¶
- The - CMAKE_AIX_SHARED_LIBRARY_ARCHIVEvariable and corresponding- AIX_SHARED_LIBRARY_ARCHIVEtarget property were added to create shared libraries on AIX as shared library archives.
- The - CMAKE_EXPORT_BUILD_DATABASEvariable, a corresponding- CMAKE_EXPORT_BUILD_DATABASEenvironment variable, and an- EXPORT_BUILD_DATABASEtarget property, were added to enable exporting C++ module compile commands. This is only supported with Ninja Generators.
- The - CMAKE_HOST_EXECUTABLE_SUFFIXvariable was added to provide the suffix for executable names on the host platform.
- The - CMAKE_<LANG>_HOST_COMPILER_IDand- CMAKE_<LANG>_HOST_COMPILER_VERSIONvariables were added, where- <LANG>is either- CUDAor- HIP. They are populated when- CMAKE_<LANG>_COMPILER_IDis- NVIDIAto identify NVCC's host compiler.
- The - CMAKE_<LANG>_STANDARD_LINK_DIRECTORIESvariable was added. Toolchain files can set this variable to control which link library directory paths are always passed to the compiler for the specified language.
- The - CMAKE_LINK_LIBRARIES_STRATEGYvariable and corresponding- LINK_LIBRARIES_STRATEGYtarget property were added to optionally specify the strategy CMake uses to generate link lines.
- The - CMAKE_CONFIG_DIRenvironment variable was added to specify a CMake user-wide configuration directory for- cmake-file-api(7)queries.
Properties¶
- The - MACOSX_FRAMEWORK_BUNDLE_NAMEtarget property was added to set the- CFBundleNamekey in an Apple- FRAMEWORK's- Info.plistfile.
- The - UNITY_BUILDtarget property now supports the- CUDAlanguage.
- The - VS_FRAMEWORK_REFERENCEStarget property was added to tell Visual Studio Generators to add framework references.
Modules¶
- Check modules now support a - CMAKE_REQUIRED_LINK_DIRECTORIESvariable. The following modules gained this support:
- The - CMakePackageConfigHelpersmodule's- generate_apple_platform_selection_file()function gained support for iOS Mac Catalyst.
- The - GoogleTestmodule- gtest_discover_tests()command gained a new- DISCOVERY_EXTRA_ARGSkeyword. It allows extra arguments to be appended to the command line when querying for the list of tests.
- The - FindCUDAToolkitmodule now provides a- CUDA::nvml_statictarget.
- The - FindOpenMPmodule gained support for the- CUDAlanguage.
CTest¶
- The - ctest_submit()command and- ctest -T Submitstep now verify TLS server certificates for connections to- https://URLs by default. See the- CTEST_TLS_VERIFYvariable for details.
- The - ctest_submit()command and- ctest -T Submitstep now require TLS 1.2 or higher for connections to- https://URLs by default. See the- CTEST_TLS_VERSIONvariable for details.
CPack¶
- The - CPack DEB Generatorgained a- CPACK_DEBIAN_PACKAGE_MULTIARCHoption to support multi-arch packages.
- The - CPack IFW Generatorgained the new- CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLSvariable to specify images associated with entries of- CPACK_IFW_PACKAGE_PRODUCT_IMAGES. This feature is available for QtIFW 4.0 and newer.
- The - CPack RPM Generatorgained support for- zstdas a- CPACK_RPM_COMPRESSION_TYPEvalue.
- The - CPackmodule enables per-machine installation by default in the- CPack WIX Generator. See policy- CMP0172and the- CPACK_WIX_INSTALL_SCOPEvariable.
Deprecated and Removed Features¶
- Compatibility with versions of CMake older than 3.10 is now deprecated and will be removed from a future version. Calls to - cmake_minimum_required()or- cmake_policy()that set the policy version to an older value now issue a deprecation diagnostic.
- The - CMakeFindFrameworksmodule has been deprecated via- CMP0173. Projects should use- find_library()instead.
- The - Visual Studio 12 2013generator has been removed.
Other Changes¶
- When static libraries on link lines are de-duplicated (by policy - CMP0156), the first occurrence is now kept on all platforms. See policy- CMP0179.
- Empty list elements in the - TEST_LAUNCHERand- CROSSCOMPILING_EMULATORtarget properties are now preserved by:- The - add_test()command.
- The - ExternalData_Add_Test()command from the- ExternalDatamodule.
- The - gtest_add_tests()and- gtest_discover_tests()commands from the- GoogleTestmodule. Empty list elements after the- EXTRA_ARGSkeyword of these two commands are also now preserved.
 - See policy - CMP0178.
- The - execute_process()command's- ENCODINGoption, meaningful on Windows, now defaults to- UTF-8. See policy- CMP0176.
- The - file(DOWNLOAD)and- file(UPLOAD)commands now verify TLS server certificates for connections to- https://URLs by default. See the- CMAKE_TLS_VERIFYvariable for details. This change was made without a policy so that users are protected even when building projects that have not been updated. Users may set the- CMAKE_TLS_VERIFYenvironment variable to- 0to restore the old default.
- The - file(DOWNLOAD)and- file(UPLOAD)commands now require TLS 1.2 or higher for connections to- https://URLs by default. See the- CMAKE_TLS_VERSIONvariable for details.
- The - file(GET_RUNTIME_DEPENDENCIES)command was updated to more closely match the dynamic loader's behavior on Linux.
- The - install()command's- DESTINATIONarguments are now normalized, with the exception of- INCLUDES DESTINATIONarguments in- install(TARGETS). See policy- CMP0177.
- The - project()command now always sets- <PROJECT-NAME>_SOURCE_DIR,- <PROJECT-NAME>_BINARY_DIR, and- <PROJECT-NAME>_IS_TOP_LEVELas both normal variables and cache entries. See policy- CMP0180.
- The - cmake_parse_arguments(PARSE_ARGV)command now defines a variable for an empty string after a single-value keyword. See policy- CMP0174.
Updates¶
Changes made since CMake 3.31.0 include the following.
3.31.1, 3.31.2, 3.31.3, 3.31.4, 3.31.5, 3.31.6, 3.31.7¶
- These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions. 
