Skip to content

Commit 64898cc

Browse files
[cmake] Introduce LLVM_DISABLE_PROJECTS to easily exclude projects
1 parent d42a1d4 commit 64898cc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

llvm/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ if(NOT "${FOUND_INDEX}" STREQUAL "-1")
138138
list(REMOVE_ITEM LLVM_ENABLE_PROJECTS "pstl")
139139
endif()
140140

141+
foreach(proj ${LLVM_DISABLE_PROJECTS})
142+
list(REMOVE_ITEM LLVM_ENABLE_PROJECTS "${proj}")
143+
endforeach ()
144+
141145
foreach(proj ${LLVM_ENABLE_PROJECTS})
142146
if (NOT proj STREQUAL "llvm" AND NOT "${proj}" IN_LIST LLVM_KNOWN_PROJECTS)
143147
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")
666670
set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${LLVM_ALL_EXPERIMENTAL_TARGETS})
667671
endif()
668672

669-
if("flang" IN_LIST LLVM_ENABLE_PROJECTS AND
673+
if("flang" IN_LIST LLVM_ENABLE_PROJECTS AND
670674
"AArch64" IN_LIST LLVM_TARGETS_TO_BUILD AND
671675
NOT ("compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES OR "compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS))
672676
message(STATUS "Enabling compiler-rt as a dependency of Flang")

llvm/docs/CMake.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,14 @@ its enabled sub-projects. Nearly all of these variable names begin with
435435
of the machine where LLVM is being built. If you are building a cross-compiler,
436436
set it to the target triple of your desired architecture.
437437

438+
**LLVM_DISABLE_PROJECTS**:STRING
439+
Semicolon-separated list of projects to exclude from the build. Sometimes it is
440+
more convenient to exclude a few projects than to have to enumerate all other
441+
projects. This flag can be combined with ``LLVM_ENABLE_PROJECTS`` to easily
442+
select projects of interest in the build. For example, the command:
443+
``cmake ... -DLLVM_ENABLE_PROJECTS=all -DLLVM_DISABLE_PROJECTS=libclc ...``
444+
allows to build all projects but ``libclc``.
445+
438446
**LLVM_DOXYGEN_QCH_FILENAME**:STRING
439447
The filename of the Qt Compressed Help file that will be generated when
440448
``-DLLVM_ENABLE_DOXYGEN=ON`` and

0 commit comments

Comments
 (0)