[llvm] [cmake] Introduce LLVM_DISABLE_PROJECTS to easily exclude projects (PR #141535)
Hamid El Maazouz via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 17 18:03:34 PDT 2025
https://github.com/hamidelmaazouz updated https://github.com/llvm/llvm-project/pull/141535
>From 64898cc27e6d48f3069f4bb44659051c9e1fca94 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 | 6 +++++-
llvm/docs/CMake.rst | 8 ++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index b672cb9365284..ebf0977512513 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -138,6 +138,10 @@ if(NOT "${FOUND_INDEX}" STREQUAL "-1")
list(REMOVE_ITEM LLVM_ENABLE_PROJECTS "pstl")
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?")
@@ -666,7 +670,7 @@ if(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD STREQUAL "all")
set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${LLVM_ALL_EXPERIMENTAL_TARGETS})
endif()
-if("flang" IN_LIST LLVM_ENABLE_PROJECTS AND
+if("flang" IN_LIST LLVM_ENABLE_PROJECTS AND
"AArch64" IN_LIST LLVM_TARGETS_TO_BUILD AND
NOT ("compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES OR "compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS))
message(STATUS "Enabling compiler-rt as a dependency of Flang")
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 30b71bffaf76f..e49fd07829771 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -435,6 +435,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