[llvm] [llvm][cmake] Error if lldb project is enabled without clang (PR #149055)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 07:16:59 PDT 2025


https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/149055

>From 729261689b93784776beb2d1dc64b76180182281 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 16 Jul 2025 09:57:45 +0000
Subject: [PATCH 1/2] [llvm][cmake] Error if lldb project is enabled without
 clang

Fixes https://github.com/llvm/llvm-project/issues/54555

We could do what flang does and enable clang automatically,
but I personally prefer making the user make the choice.

Also from a buld requirements perspective, flang is a bigger
build than clang. So if you're already set on building flang,
clang should be within your budget too. lldb is smaller than
clang.
---
 llvm/CMakeLists.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 3f8201fa426fe..bf52533abe525 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -179,6 +179,12 @@ if ("flang" IN_LIST LLVM_ENABLE_PROJECTS)
   endif ()
 endif()
 
+if ("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
+  if (NOT "clang" IN_LIST LLVM_ENABLE_PROJECTS)
+    message(FATAL_ERROR "Clang is not enabled, but is required for lldb.")
+  endif ()
+endif ()
+
 if ("libc" IN_LIST LLVM_ENABLE_PROJECTS)
   message(WARNING "Using LLVM_ENABLE_PROJECTS=libc is deprecated.  Please use "
     "-DLLVM_ENABLE_RUNTIMES=libc or see the instructions at "

>From c3d1356ac7c802c4df99281bd39f3101834ed72c Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 16 Jul 2025 14:16:43 +0000
Subject: [PATCH 2/2] add clang

---
 llvm/CMakeLists.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index bf52533abe525..903461b39902e 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -181,8 +181,9 @@ endif()
 
 if ("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
   if (NOT "clang" IN_LIST LLVM_ENABLE_PROJECTS)
-    message(FATAL_ERROR "Clang is not enabled, but is required for lldb.")
-  endif ()
+    message(STATUS "Enabling clang as a dependency of lldb")
+    list(APPEND LLVM_ENABLE_PROJECTS "clang")
+  endif()
 endif ()
 
 if ("libc" IN_LIST LLVM_ENABLE_PROJECTS)



More information about the llvm-commits mailing list