CMake 3.23 Release Notes

Changes made since CMake 3.22 include the following.

New Features

Presets

  • cmake-presets(7) files now support schema version 4.

  • cmake-presets(7) files now have an optional include field, which allows the files to include other files.

  • cmake-presets(7) files now support a ${fileDir} macro, which contains the directory containing the preset file.

  • cmake-presets(7) gained support for specifying the resolvePackageReferences command line option in a build preset to control restoration behavior of package references from external package managers. Currently this is only supported by the Visual Studio generator to support restoring packages from NuGet. Other generators ignore this option.

Generators

Command-Line

  • The cmake(1) --build command, when used with Visual Studio Generators on projects that set the VS_PACKAGE_REFERENCES target property, now automatically restores package references from NuGet. The cache variable CMAKE_VS_NUGET_PACKAGE_RESTORE may be set to toggle this behavior in a build tree. Use the --resolve-package-references=<on|off|only> command-line option to control the behavior on one invocation.

  • The cmake(1) command line tool gained a --debug-find-pkg= option to enable debug messages under specific find_package() calls.

  • The cmake(1) command line tool gained a --debug-find-var= option to enable debug messages for find_* calls that use specific result variables.

Compilers

  • The IBM Open XL C/C++ compiler, based on LLVM, is now supported with compiler id IBMClang.

  • The MCST LCC compiler is now supported with compiler id LCC. See policy CMP0129.

File-Based API

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

  • The cmake-file-api(7) "codemodel" version 2 directory object installers field gained a new fileSet installer type.

Commands

  • The define_property() command gained a new INITIALIZE_FROM_VARIABLE option to cause a target property to be initialized from a variable when a target is created.

  • The install(TARGETS) command gained a new FILE_SET argument, which can be used to install header file sets associated with a target.

  • The string(TIMESTAMP) and file(TIMESTAMP) commands now support the %f specifier for microseconds.

  • The target_sources() command gained a new FILE_SET mode, which can be used to add headers as header-only source files of a target.

Variables

Properties

Modules

  • The CheckPIESupported module now supports the OBJC, OBJCXX, CUDA, and HIP languages. It also now honors CMAKE_SYSROOT and CMAKE_OSX_SYSROOT.

  • The ExternalProject module's ExternalProject_Add() command gained support for a USES_TERMINAL_PATCH option to give the patch step exclusive terminal access.

  • The FindCUDAToolkit module now provides a target for libcufft_static_nocallback, if found.

  • The FindGLUT module now provides the GLUT_INCLUDE_DIRS result variable to conform with naming conventions documented in the cmake-developer(7) manual. This supersedes the legacy GLUT_INCLUDE_DIR variable.

  • The FindGTest module now provides a target for GMock, if found.

  • The FindVulkan module now provides a Vulkan_VERSION result variable reporting the version number.

CTest

CPack

Deprecated and Removed Features

  • cmake(1) now warns when multiple source paths are specified, as in cmake -S src1 src2. This has never been officially documented or supported, but older versions accidentally accepted multiple source paths and used the last path specified. Update scripts to avoid passing multiple source path arguments.

  • The cpack(1) undocumented OSXX11 generator has been removed.

  • The previously undocumented CPACK_PACKAGEMAKER_CHOICES variable used in the CPack.distribution.dist.in template has been replaced by a new CPACK_APPLE_PKG_INSTALLER_CONTENT variable. This only affects projects that were providing their own custom CPack.distribution.dist.in template file, but still relied on CPACK_PACKAGEMAKER_CHOICES being set. Those custom template files should be updated to use CPACK_APPLE_PKG_INSTALLER_CONTENT instead, or to fully define all the template file's contents without relying on substitution of either variable.

Other Changes

Updates

Changes made since CMake 3.23.0 include the following.

3.23.1

  • The target_sources() FILE_SET feature added in CMake 3.23.0 does not yet place header files properly in Apple FRAMEWORK targets. Pending further work in a future version of CMake, it is now an error to add a FILE_SET of type HEADERS to such targets on Apple platforms.

  • The HEADER_SETS and INTERFACE_HEADER_SETS target properties added in CMake 3.23.0 are now read-only records of the header sets created by the target_sources() command.

3.23.2

  • The CPACK_PACKAGEMAKER_CHOICES variable used in the CPack.distribution.dist.in template file was replaced by a new CPACK_APPLE_PKG_INSTALLER_CONTENT variable in CMake 3.23.0. This broke projects that provided their own template file but still expected the CPACK_PACKAGEMAKER_CHOICES variable to be defined. The old CPACK_PACKAGEMAKER_CHOICES variable is now also set to the same content as it was before, but it is formally deprecated.