[llvm-dev] [RFC] [CMake] Removing support for LLVM_TOOL_<PROJECT> CMake cache variables

Dan Liew via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 5 01:59:13 PST 2019


In our CMake build system there are currently two ways of specifying
which LLVM sub projects to build by setting CMake cache variables.

* Setting `LLVM_ENABLE_PROJECTS` to the list of projects to enable
(e.g. `-DLLVM_ENABLE_PROJECTS=clang;compiler-rt`)
* Setting `LLVM_TOOL_<PROJECT>_BUILD` boolean CMake cache variables

Having two different ways of specifying the same thing is problematic
because from the CMake perspective because we can't detect which way
the user actually wants to use.

Since r353148 if `LLVM_ENABLE_PROJECTS` is set by the user then that
is used to determine which projects are built and any user specified
value for the `LLVM_TOOL_<PROJECT>_BUILD` variables get overridden.
`LLVM_ENABLE_PROJECTS`  currently only works with the new mono-repo
layout (projects outside of the LLVM source tree) which basically
means that:

* `LLVM_ENABLE_PROJECTS` is used for the mono repo project layout
*  `LLVM_TOOL_<PROJECT>_BUILD`  is used for the traditional in-tree
project layout (e.g. projects located at `tools/clang`, `tools/lldb`,

This is a bit of a mess and I'd like to propose we switch to only
using  `LLVM_ENABLE_PROJECTS` and remove support for

I see two ways of doing this:

* Graceful. We'll eventually move everyone over to the mono repo
layout anyway so just drop support for `LLVM_TOOL_<PROJECT>_BUILD`
variables as part of the process of removing support for the in-tree
subprojects inside the LLVM source tree. We just need to document this
change clearly.

* Aggressive. Remove support for setting `LLVM_TOOL_<PROJECT>_BUILD`
variables and only use `LLVM_ENABLE_PROJECTS`. The logic for
`LLVM_ENABLE_PROJECTS` would need to be changed to work with in-tree

I'd prefer Graceful because it's less work and I actually have old
scripts that rely on setting `LLVM_TOOL_<PROJECT>_BUILD` variables.
Others might too.



More information about the llvm-dev mailing list