CMake 4.1 發行備註¶
Changes made since CMake 4.0 include the following.
新功能¶
File-Based API¶
The
cmake-file-api(7)
v1 now writes partial replies when buildsystem generation fails with an error. See the v1 Reply Error Index.
生成器¶
Makefile 生成器 and Ninja 生成器 gained support for adding a linker launcher with
Fortran
,CUDA
, andHIP
. See theCMAKE_<LANG>_LINKER_LAUNCHER
variable and<LANG>_LINKER_LAUNCHER
target property for details.
命令行¶
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
cmake-configure-log(7)
now reports events fromfind_package()
(inCONFIG
mode),find_path()
,find_file()
,find_library()
, andfind_program()
commands when first invoked, when their results transition between "not found" and "found", or when enabled explicitly by the--debug-find
command-line option. See Event Kind find and Event Kind find_package. Logging may also be controlled by theCMAKE_FIND_DEBUG_MODE
andCMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG
variables.
編譯器¶
Diab compilers from Wind River Systems, versions 5.9.x+, are now supported with
compiler id
Diab
for languagesASM
,C
, andCXX
.
命令¶
The
add_dependencies()
command may be called with no dependencies.The
cmake_pkg_config()
command now supports theIMPORT
andPOPULATE
subcommands for interfacing CMake targets with pkg-config based dependencies.The
install(DIRECTORY)
command gained a newEXCLUDE_EMPTY_DIRECTORIES
option to skip installation of empty directories.The
project()
command now has experimental support for theCOMPAT_VERSION
keyword, gated byCMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO
.
變數¶
The
CMAKE_FIND_REQUIRED
variable was added to tellfind_package()
,find_path()
,find_file()
,find_library()
, andfind_program()
to beREQUIRED
by default. The commands also gained anOPTIONAL
keyword to ignore the variable for a specific call.The
CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID
variable is now populated for most compilers, and documented for public use.The
CMAKE_<LANG>_ICSTAT
variable and corresponding<LANG>_ICSTAT
target property were added to tell the Makefile 生成器 and the Ninja 生成器 to run the IARicstat
tool along with the compiler forC
andCXX
languages.
環境變數¶
The
CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES_EXCLUDE
environment variable was added to optionally exclude specific libraries from the detected set ofCMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES
.
屬性¶
The
AUTOMOC_INCLUDE_DIRECTORIES
target property and associatedCMAKE_AUTOMOC_INCLUDE_DIRECTORIES
variable were added to override the automatic discovery of moc includes from a target's transitive include directories.The
MACOSX_PACKAGE_LOCATION
source file property now works when set on a source directory, and copies its entire tree into the bundle.The
PDB_NAME
andCOMPILE_PDB_NAME
target properties now supportgenerator expressions
.
模組¶
The
FindASPELL
module now provides a version variable, imported targets, and components to optionally select the Aspell library and executable separately.The
FindBLAS
andFindLAPACK
modules now support the NVIDIA Performance Libraries (NVPL).The
FindProtobuf
module'sprotobuf_generate(DEPENDENCIES)
command argument now accepts multiple values.The
FindProtobuf
module'sprotobuf_generate_cpp()
andprotobuf_generate_python()
commands, together with theirProtobuf_IMPORT_DIRS
andPROTOBUF_GENERATE_CPP_APPEND_PATH
hint variables, are now deprecated in favor of theprotobuf_generate()
command.
常規表達式¶
The
string(REGEX MATCHALL)
,string(REGEX REPLACE)
, andlist(TRANSFORM REPLACE)
commands now match the regular expression^
anchor at most once in repeated searches, at the start of the input. See policyCMP0186
.The
string(REGEX REPLACE)
command now allows references to unmatched groups. They are replaced with empty strings.The
string(REGEX MATCH)
,string(REGEX MATCHALL)
, andstring(REGEX REPLACE)
commands now allow zero-length matches.
CTest¶
ctest(1)
gained a--schedule-random-seed
option to specify a numeric random seed to makectest --schedule-random
deterministic for reproduction.
CPack¶
The
CPack NuGet Generator
gained optionCPACK_NUGET_SYMBOL_PACKAGE
to generate NuGet symbol packages containing PDB files.The
CPack RPM Generator
gainedCPACK_RPM_PACKAGE_ENHANCES
,CPACK_RPM_PACKAGE_RECOMMENDS
, andCPACK_RPM_PACKAGE_SUPPLEMENTS
variables to specify the corresponding RPM spec fields.
Deprecated and Removed Features¶
The
FindGTest
module's result variablesGTEST_INCLUDE_DIRS
,GTEST_LIBRARIES
,GTEST_MAIN_LIBRARIES
, andGTEST_BOTH_LIBRARIES
are now deprecated in favor of usingGTest::gtest
andGTest::gtest_main
imported targets.The
FindGCCXML
module has been deprecated via policyCMP0188
. Port projects to CastXML instead.The
FindCABLE
module has been deprecated via policyCMP0191
.The
CMakeDetermineVSServicePack
module has been deprecated via policyCMP0196
. Port projects to theCMAKE_<LANG>_COMPILER_VERSION
variable instead.
其他變更¶
The
ExternalProject
module no longer checks theURL
archive file extension. Any archive type thatcmake -E tar
can extract is now allowed.Modules
FindPython3
,FindPython2
andFindPython
now enforce consistency of artifacts in cross-compiling mode. This prevents mixing host and target artifacts. See policyCMP0190
.The
GNUInstallDirs
module now prefers to defaultSYSCONFDIR
,LOCALSTATEDIR
, andRUNSTATEDIR
to absolute paths when installing to special prefixes. See policyCMP0192
.The
GNUInstallDirs
module now cachesCMAKE_INSTALL_*
variables with their leadingusr/
for install prefix/
. See policyCMP0193
.The
install(TARGETS)
command no longer ignores file sets which haven't been defined at the point it is called. The ordering oftarget_sources(FILE_SET)
andinstall(TARGETS)
is no longer semantically relevant.Enabling
ASM
no longer accidentally succeeds usingMSVC
'scl
C compiler as an assembler. See policyCMP0194
.The MSVC link
-machine:
flag is no longer added to theCMAKE_*_LINKER_FLAGS
variables. See policyCMP0197
.The
TARGET_PROPERTY
generator expression now evaluates theLINK_LIBRARIES
andINTERFACE_LINK_LIBRARIES
target properties transitively. See policyCMP0189
.