CMake 3.23 Release Notes¶
Contents
Changes made since CMake 3.22 include the following.
New Features¶
Presets¶
cmake-presets(7)files now support schema version4.cmake-presets(7)files now have an optionalincludefield, 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 theresolvePackageReferencescommand 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¶
The Visual Studio Generators for VS 2019 and above learned to support .NET SDK-style project files (
.csproj) for C# projects. See theDOTNET_SDKtarget property and correspondingCMAKE_DOTNET_SDKvariable.add_custom_command()is not yet supported in .NET SDK-style projects.The Visual Studio Generators for VS 2017 and above learned to use portable instances of Visual Studio not known to the VS installer. See the
CMAKE_GENERATOR_INSTANCEvariable.
Command-Line¶
The
cmake(1)--buildcommand, when used with Visual Studio Generators on projects that set theVS_PACKAGE_REFERENCEStarget property, now automatically restores package references from NuGet. The cache variableCMAKE_VS_NUGET_PACKAGE_RESTOREmay 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 specificfind_package()calls.The
cmake(1)command line tool gained a--debug-find-var=option to enable debug messages forfind_*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 policyCMP0129.
File-Based API¶
The
cmake-file-api(7)"codemodel" version 2versionfield has been updated to2.4.The
cmake-file-api(7)"codemodel" version 2directoryobjectinstallersfield gained a newfileSetinstaller type.
Commands¶
The
define_property()command gained a newINITIALIZE_FROM_VARIABLEoption to cause a target property to be initialized from a variable when a target is created.The
install(TARGETS)command gained a newFILE_SETargument, which can be used to install header file sets associated with a target.The
string(TIMESTAMP)andfile(TIMESTAMP)commands now support the%fspecifier for microseconds.The
target_sources()command gained a newFILE_SETmode, which can be used to add headers as header-only source files of a target.
Variables¶
The
CMAKE_CUDA_ARCHITECTURESvariable and associatedCUDA_ARCHITECTUREStarget property now support theall, andall-majorvalues for CUDA toolkit 7.0+.The
CMAKE_IGNORE_PREFIX_PATHandCMAKE_SYSTEM_IGNORE_PREFIX_PATHvariables were added to tell thefind_package(),find_program(),find_library(),find_path(), andfind_file()commands to ignore specified prefixes.The
CMAKE_LINK_LIBRARIES_ONLY_TARGETSvariable and correspondingLINK_LIBRARIES_ONLY_TARGETStarget property were added to optionally require that all link items that can be target names are actually names of existing targets.
Properties¶
The
HEADER_SETSandINTERFACE_HEADER_SETSread-only target properties were added to list header sets associated with a target.The
HEADER_SETandHEADER_SET_<NAME>target properties were added to list files in the default header set and named header sets, respectively.The
HEADER_DIRSandHEADER_DIRS_<NAME>target properties were added to specify the base directories of the default header set and named header sets, respectively.The
IMPORTED_NO_SYSTEMtarget property was added to specify that an Imported Target should not be treated as a system library (i.e. its include directories are not automaticallySYSTEM).The
XCODE_EMBED_PLUGINStarget property was added to tell theXcodegenerator what targets to put in theEmbed PlugInsbuild phase.The
XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODEtarget property and supportingCMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODEvariable were added to tell theXcodegenerator to enable specifying the Xcode scheme option propertyGPU Frame Capture.
Modules¶
The
CheckPIESupportedmodule now supports theOBJC,OBJCXX,CUDA, andHIPlanguages. It also now honorsCMAKE_SYSROOTandCMAKE_OSX_SYSROOT.The
ExternalProjectmodule'sExternalProject_Add()command gained support for aUSES_TERMINAL_PATCHoption to give the patch step exclusive terminal access.The
FindCUDAToolkitmodule now provides a target forlibcufft_static_nocallback, if found.The
FindGLUTmodule now provides theGLUT_INCLUDE_DIRSresult variable to conform with naming conventions documented in thecmake-developer(7)manual. This supersedes the legacyGLUT_INCLUDE_DIRvariable.The
FindGTestmodule now provides a target for GMock, if found.The
FindVulkanmodule now provides aVulkan_VERSIONresult variable reporting the version number.
CTest¶
ctest(1)gained a newCTEST_SUBMIT_INACTIVITY_TIMEOUTvariable, which can be used to specify a timeout for submission inactivity.
CPack¶
The
CPack productbuild Generatorgained the newCPACK_PRODUCTBUILD_DOMAINS,CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE,CPACK_PRODUCTBUILD_DOMAINS_USER, andCPACK_PRODUCTBUILD_DOMAINS_ROOTvariables for adding the domains element to the Distribution XML. With these variables, it is now possible to install products to the user's home directory without requiring administrative privileges.The
CPack productbuild Generatorgained a new variable,CPACK_PRODUCTBUILD_IDENTIFIER, used to customize the unique product identifier associated with the product.The
CPack.distribution.dist.intemplate used by theCPack productbuild GeneratorandCPack PackageMaker Generatorwas updated to use a newCPACK_APPLE_PKG_INSTALLER_CONTENTvariable for its main content. This replaced the previously undocumented and now deprecatedCPACK_PACKAGEMAKER_CHOICESvariable.The
CPack IFW Generatorgained the newCPACK_IFW_ARCHIVE_FORMATandCPACK_IFW_ARCHIVE_COMPRESSIONvariables for setting the format used when packaging new component data archives, and choosing the compression level used. These features are available for QtIFW 4.2 and newer.The
CPack IFW Generatorgained newCPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACEvariable to prevent the user from passing any consumer command to the installer, likeinstall,update, andremove. This feature is available for QtIFW 4.0 and newer.The
CPack IFW Generatorgained the newCPACK_IFW_PACKAGE_PRODUCT_IMAGESvariable for adding a list of images to be shown on thePerformInstallationPage. This feature is available for QtIFW 4.0 and newer.The
CPack IFW Generatorgained the newCPACK_IFW_PACKAGE_RUN_PROGRAM,CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS, andCPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTIONvariables for executing a command after the installer is done if the user accepts the action. This feature is available for QtIFW 4.0 and newer.The
CPack IFW Generatorgained the newCPACK_IFW_PACKAGE_SIGNING_IDENTITYvariable for specifying a code signing identity to be used for signing the generated app bundle. This feature is available on macOS only, and for QtIFW 3.0 and newer.The
CPack WIX Generatorgained a new variable,CPACK_WIX_SKIP_WIX_UI_EXTENSION, to skip the inclusion of WixUIExtensions.
Deprecated and Removed Features¶
cmake(1)now warns when multiple source paths are specified, as incmake -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)undocumentedOSXX11generator has been removed.The previously undocumented
CPACK_PACKAGEMAKER_CHOICESvariable used in theCPack.distribution.dist.intemplate has been replaced by a newCPACK_APPLE_PKG_INSTALLER_CONTENTvariable. This only affects projects that were providing their own customCPack.distribution.dist.intemplate file, but still relied onCPACK_PACKAGEMAKER_CHOICESbeing set. Those custom template files should be updated to useCPACK_APPLE_PKG_INSTALLER_CONTENTinstead, or to fully define all the template file's contents without relying on substitution of either variable.
Other Changes¶
The
CPack DragNDrop Generatorno longer attachesCPACK_RESOURCE_FILE_LICENSEas the license agreement in the generated.dmgunless explicitly activated by aCPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSEoption. In CMake projects, theCPackmodule enables the option by default for compatibility.CUDAtargets may now enable bothCUDA_SEPARABLE_COMPILATIONandCUDA_PTX_COMPILATION.CUDAcompiler detection now:issues an error in all cases when it's unable to compute the default architecture(s) if required (see
CMP0104),handles
OFFforCMAKE_CUDA_ARCHITECTURESon Clang,supports the theoretical case of multiple default architectures, and
tries to detect invalid architectures and issue an error.
CUDAwith Clang now implements policyCMP0105and the$<DEVICE_LINK:...>and$<HOST_LINK:...>generator expressions.The
define_property()command'sBRIEF_DOCSandFULL_DOCSarguments are now optional.ccmake(1)may now be enabled on Windows when building CMake from source. This is experimental, and so is not included in official distributions.
Updates¶
Changes made since CMake 3.23.0 include the following.
3.23.1¶
The
target_sources()FILE_SETfeature added in CMake 3.23.0 does not yet place header files properly in AppleFRAMEWORKtargets. Pending further work in a future version of CMake, it is now an error to add aFILE_SETof typeHEADERSto such targets on Apple platforms.The
HEADER_SETSandINTERFACE_HEADER_SETStarget properties added in CMake 3.23.0 are now read-only records of the header sets created by thetarget_sources()command.
3.23.2¶
The
CPACK_PACKAGEMAKER_CHOICESvariable used in theCPack.distribution.dist.intemplate file was replaced by a newCPACK_APPLE_PKG_INSTALLER_CONTENTvariable in CMake 3.23.0. This broke projects that provided their own template file but still expected theCPACK_PACKAGEMAKER_CHOICESvariable to be defined. The oldCPACK_PACKAGEMAKER_CHOICESvariable is now also set to the same content as it was before, but it is formally deprecated.