From 6955f73819b768470ea6be8fe536905846d886d5 Mon Sep 17 00:00:00 2001 From: David Truby Date: Mon, 16 Dec 2024 17:13:02 +0000 Subject: [PATCH] [flang] Add cmake error if building with clang-cl and MSVC 17.12 A bug in the C++ library in MSVC 17.12 prevents clang-cl from being able to build flang with that library version. This bug is not present in 17.11 or earlier, nor in 17.13. This patch adds a cmake error telling the user to either upgrade or downgrade to avoid the bug. --- flang/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 971e5d5c93f23..80278ff63e481 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -66,6 +66,13 @@ if (MSVC AND CMAKE_CXX_COMPILER_ID MATCHES Clang) if (IS_DIRECTORY "${LIBDIR}") link_libraries(${CLANG_RT_BUILTINS_LIBRARY}) endif() + + if (MSVC_VERSION EQUAL 1942) + message(FATAL_ERROR "Flang cannot be built with clang and the MSVC 17.12 " + "toolchain version. Please upgrade to 17.13 or later, or switch " + "to the 17.10 LTSC release. " + "See https://github.com/microsoft/STL/issues/4959 for more details.") + endif() endif() if(CMAKE_SIZEOF_VOID_P EQUAL 4)