CMake changelog for 3.27 .. 3.31
CMake 3.31 additions include:
- CMake warns if
cmake_minimum_required()is < 3.10. - TLS ≥ 1.2 is required by default for internet operations e.g.
file(DOWNLOAD), ExternalProject, FetchContent, and similar. - file(ARCHIVE_CREATE)
gained a long-needed
WORKING_DIRECTORYparameter that is essentially necessary to avoid machine-specific paths being embedded in the archive. - CMAKE_LINK_LIBRARIES_STRATEGY allows specifying a strategy for ordering target direct link dependencies.
CMake 3.30 additions include:
- C++26 support.
- CMAKE_TLS_VERIFY environment variable was added to set TLS verification (true, false).
- defaults CMAKE_TLS_VERIFY to on, where previously it was off.
- CTest can use the
--test-dirargument with--preset, which avoids needing to be locked into a specific build directory.
CMake 3.29 additions include:
- cmake_language(EXIT code) to exit CMake script mode with a specific return code. This is useful when using CMake as a platform-agnostic scripting language instead of shell script.
- Environment variable
CMAKE_INSTALL_PREFIX
is used to set the default install prefix across projects–it can be overridden as typical by
cmake -DCMAKE_INSTALL_PREFIX=option. - Target property TEST_LAUNCHER allows specifying a test launcher. For MPI program this allows deduplicating or making more programmatic test runner scripts.
- Linker information variables including
CMAKE_
_COMPILER_LINKER_ID have been added to allow programmatic logic like settingtarget_link_options()based on the particular linker. ctest --parallelwithout a number or0will use unbounded test run parallelism.
CMake 3.28 additions include:
-
changes PATH behavior for Windows find_{library,path,file}() to no longer search PATH. This may break some projects that rely on PATH for finding libraries. MSYS2-distributed CMake is patched to include PATH like earlier CMake, which can be confusing for CI etc. not using MSYS CMake with that patch. Windows CI/user may need to specify
CMAKE_PREFIX_PATHlikecmake -DCMAKE_PREFIX_PATH=$Env:SYSTEMDRIVE/msys64/ucrt64/lib -B build -
Support for C++20 modules is considerably improved and most users will want at least CMake 3.28 to make C++ modules usable.
-
Generator expressions
$<IF> $<AND> $<OR>now short circuit. -
Test properties now have a
DIRECTORYparameter, useful for setting test parameters from the project’s top level CMakeLists.txt. -
CMake 3.28.4 fixed a long-standing bug in Ninja Fortran targets that use
includestatements.
CMake 3.27 additions include:
- emits warning for cmake_minimum_required(VERSION) < 3.5.
- CTest test properties TIMEOUT_SIGNAL_NAME and TIMEOUT_SIGNAL_GRACE_PERIOD specify a POSIX signal to send to a timed out test process.
- Interactive CMake debugger added by
cmake --debuggeris used with an IDE such as Visual Studio. - CMake script command cmake_file_api() allows querying CMake File API from within CMake.
ℹ️ Note
Fortran + Ninja was broken for OBJECT libraries in CMake 3.27.0..3.27.8 and fixed in 3.27.9.