[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 May 26 16:47:13 PDT 2025
https://github.com/hamidelmaazouz created https://github.com/llvm/llvm-project/pull/141535
Introduces `LLVM_DISABLE_PROJECTS` to easily exclude projects from the build as described in
https://github.com/llvm/llvm-project/issues/141502
>From eeb249f784cc2f9c8b9d79ff5885484d7d865192 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 | 5 +++++
llvm/docs/CMake.rst | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index ed44b16bf9aeb..3ae6c29b8cd00 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -125,6 +125,11 @@ set(LLVM_ENABLE_PROJECTS "" CACHE STRING
if( LLVM_ENABLE_PROJECTS STREQUAL "all" )
set( LLVM_ENABLE_PROJECTS ${LLVM_ALL_PROJECTS})
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 674e4969c6912..903a0f5d7c180 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -436,6 +436,14 @@ 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 via . 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