CMake 4.1 發行備註

Changes made since CMake 4.0 include the following.

新功能

File-Based API

生成器

命令行

  • The cmake --build command-line tool, when used with the Xcode generator, now detects when a third-party tool has wrapped the generated .xcodeproj in a .xcworkspace, and drives the build through the workspace instead.

組態日誌

編譯器

命令

  • The add_dependencies() command may be called with no dependencies.

  • The cmake_pkg_config() command now supports the IMPORT and POPULATE subcommands for interfacing CMake targets with pkg-config based dependencies.

  • The install(DIRECTORY) command gained a new EXCLUDE_EMPTY_DIRECTORIES option to skip installation of empty directories.

  • The project() command now has experimental support for the COMPAT_VERSION keyword, gated by CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO.

變數

環境變數

屬性

模組

常規表達式

CTest

CPack

Deprecated and Removed Features

其他變更

  • The ExternalProject module no longer checks the URL archive file extension. Any archive type that cmake -E tar can extract is now allowed.

  • Modules FindPython3, FindPython2 and FindPython now enforce consistency of artifacts in cross-compiling mode. This prevents mixing host and target artifacts. See policy CMP0190.

  • The GNUInstallDirs module now prefers to default SYSCONFDIR, LOCALSTATEDIR, and RUNSTATEDIR to absolute paths when installing to special prefixes. See policy CMP0192.

  • The GNUInstallDirs module now caches CMAKE_INSTALL_* variables with their leading usr/ for install prefix /. See policy CMP0193.

  • The install(TARGETS) command no longer ignores file sets which haven't been defined at the point it is called. The ordering of target_sources(FILE_SET) and install(TARGETS) is no longer semantically relevant.

  • Enabling ASM no longer accidentally succeeds using MSVC's cl C compiler as an assembler. See policy CMP0194.

  • The MSVC link -machine: flag is no longer added to the CMAKE_*_LINKER_FLAGS variables. See policy CMP0197.

  • The TARGET_PROPERTY generator expression now evaluates the LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES target properties transitively. See policy CMP0189.