CMake: Add an llvm-mingw clang version check to preserve_all

llvm has supported preserve_all abi on Windows ABI since
https://github.com/llvm/llvm-project/pull/166436.
This has been in a clang release since 22.1. Do a clang version check to
ensure the compiler is >= 22.1 to enabled preserve_all under
wow64/arm64ec.

This will give a performance boost to applications that require x87 full
precision and a couple other minor things.
This commit is contained in:
Ryan Houdek committed 2026-11-03 10:00:54 -08:00
1 parent c69f2bf042
commit c76fccf256
1 file changed
+3 -1
+3 -1
View File
@@ -254,7 +254,9 @@ check_cxx_source_compiles(
HAS_CLANG_PRESERVE_ALL)
unset(CMAKE_REQUIRED_FLAGS)
if (HAS_CLANG_PRESERVE_ALL)
if (MINGW)
message(STATUS "Clang version ${CMAKE_CXX_COMPILER_VERSION}")
set(CLANG_MINIMUM_VERSION 22.1)
if (MINGW AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${CLANG_MINIMUM_VERSION})
message(STATUS "Ignoring broken clang::preserve_all support")
set(HAS_CLANG_PRESERVE_ALL FALSE)
else()