[llvm] [cmake] Introduce LLVM_DISABLE_PROJECTS to easily exclude projects (PR #141535)
Hamid El Maazouz via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 2 05:09:12 PST 2026
https://github.com/hamidelmaazouz updated https://github.com/llvm/llvm-project/pull/141535
>From 08a1ec80f9dac535407a8e13fd6fb22ee4af8aaf Mon Sep 17 00:00:00 2001
From: Hamid El Maazouz <hamid.elmaazouz at gmail.com>
Date: Tue, 27 May 2025 00:06:00 +0100
Subject: [PATCH] [cmake] Introduce LLVM_DISABLE_PROJECTS to easily exclude
projects
---
llvm/CMakeLists.txt | 4 ++++
llvm/docs/CMake.rst | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index be028c1dab1f5..718c4860223e0 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -130,6 +130,10 @@ or to the runtimes default build
")
endif()
+foreach(proj ${LLVM_DISABLE_PROJECTS})
+ list(REMOVE_ITEM LLVM_ENABLE_PROJECTS "${proj}")
+endforeach ()
+
foreach(proj ${LLVM_ENABLE_PROJECTS})
if (NOT proj STREQUAL "llvm" AND NOT "${proj}" IN_LIST LLVM_KNOWN_PROJECTS)
MESSAGE(FATAL_ERROR "${proj} isn't a known project: ${LLVM_KNOWN_PROJECTS}. Did you mean to enable it as a runtime in LLVM_ENABLE_RUNTIMES?")
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index ec181999aec57..f5c3136c9be28 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -436,6 +436,14 @@ its enabled sub-projects. Nearly all of these variable names begin with
of the machine where LLVM is being built. If you are building a cross-compiler,
set it to the target triple of your desired architecture.
+**LLVM_DISABLE_PROJECTS**:STRING
+ Semicolon-separated list of projects to exclude from the build. Sometimes it is
+ more convenient to exclude a few projects than to have to enumerate all other
+ projects. This flag can be combined with ``LLVM_ENABLE_PROJECTS`` to easily
+ select projects of interest in the build. For example, the command:
+ ``cmake ... -DLLVM_ENABLE_PROJECTS=all -DLLVM_DISABLE_PROJECTS=libclc ...``
+ allows to build all projects but ``libclc``.
+
**LLVM_DOXYGEN_QCH_FILENAME**:STRING
The filename of the Qt Compressed Help file that will be generated when
``-DLLVM_ENABLE_DOXYGEN=ON`` and
More information about the llvm-commits
mailing list