From 7e52b65f29f0c0b4dd44fe6d2916bb0e0555334d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 11 Sep 2026 11:04:46 +0200 Subject: [PATCH] cmake(windows): accommodate for Git for Windows' migration to UCRT64 Git for Windows needs to ship with a lot of Unix tools that Git takes for granted, such as `sed`, `awk`, a C compiler and a Unix shell, just to name a few. In Git for Windows, these are provided by the MSYS2 project. Part of these tools (such as `bash.exe`) use a POSIX emulation layer ("MSYS2 runtime", a friendly fork of the Cygwin runtime), but others target a native Win32 toolchain, e.g. `git.exe`. There are multiple flavors of that toolchain, and historically Git for Windows used MINGW64 on x64 Windows. This toolchain uses the old MSVC runtime, and therefore the MSYS2 project deprecated it. As a consequence, Git for Windows switches to UCRT64 with v2.56.0. That flavor still uses GCC to compile native Win32 binaries, but targets the Universal C Runtime ("UCRT"). Internally, this means that the new `git.exe` is installed into a new prefix, `/ucrt64/`, whereas the old `git.exe` was installed into `/mingw64/`. A recently-upstreamed commit hard-codes this expectation even into the CMake-based build, so that the built `git.exe` "knows where it lives" and can ensure that the tools it expects on the `PATH` are found. Naturally, this hard-coded MINGW64 needs to change to UCRT64 now, too. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index e76bd19b65642b..7874e5a32601d5 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -258,7 +258,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP HAVE_WPGMPTR HAVE_RTLGENRANDOM) if(CMAKE_GENERATOR_PLATFORM STREQUAL "x64") - add_compile_definitions(ENSURE_MSYSTEM_IS_SET="MINGW64" MINGW_PREFIX="mingw64") + add_compile_definitions(ENSURE_MSYSTEM_IS_SET="UCRT64" MINGW_PREFIX="ucrt64") elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "arm64") add_compile_definitions(ENSURE_MSYSTEM_IS_SET="CLANGARM64" MINGW_PREFIX="clangarm64") elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x86")