[libcxx-commits] [libcxxabi] [libunwind] [libc++abi] Provide an explicit error when trying to build for MSVC (PR #119370)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 10 07:08:14 PST 2024


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/119370

>From c9f83596fbfa0423245eecbc9c4d9f65163648f1 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 10 Dec 2024 07:42:00 -0500
Subject: [PATCH] [libc++abi][libunwind] Provide an explicit error when trying
 to build for MSVC

Fixes #119322
---
 libcxxabi/CMakeLists.txt | 5 +++++
 libunwind/CMakeLists.txt | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index da0e8b286cddc1..158d61ff4fcb25 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -34,6 +34,11 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
  build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
  )
 
+if (MSVC)
+  message(FATAL_ERROR "Libc++abi can't be built for MSVC targets, and doing so is pointless anyway because such "
+                      "targets must use the MS C++ ABI, and libc++abi provides the Itanium C++ ABI.")
+endif()
+
 #===============================================================================
 # Setup CMake Options
 #===============================================================================
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index ea06dc8a67b949..3c8499fd334649 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -24,6 +24,11 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
 include(GNUInstallDirs)
 include(CheckSymbolExists)
 
+if (MSVC)
+  message(FATAL_ERROR "Libunwind doesn't build for MSVC targets, and that is almost certainly not what you want to do "
+                      "anyway since libunwind is tied to the Itanium C++ ABI, and MSVC targets must use the MS C++ ABI.")
+endif()
+
 #===============================================================================
 # Setup CMake Options
 #===============================================================================



More information about the libcxx-commits mailing list