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

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 5 16:20:03 PST 2019

For the LLVM_ENABLE_PROJECTS (and LLVM_EXTERNAL_PROJECTS) case, dropping the LLVM_TOOL_*_BUILD variables makes sense. We could just change our build code for enabling projects to ignore those variables entirely (which is essentially the case after r353148 anyway).

For in-tree builds, the LLVM_TOOL_*_BUILD variables are the only way to control including/excluding projects, and I'd like to keep them around for as long as we support in-tree builds. It's useful to have the same source tree and build different configurations from it and only enable certain projects for certain configurations.

Dropping support for in-tree builds after the monorepo migration is an interesting question, because in theory people could still nest the read-only single project mirrors (assuming those end up coming to fruition) in the same style. I think it'd be good to reduce the number of supported configurations and clean up our build; I'm adding Chris to see what he thinks.

´╗┐On 2/5/19, 1:59 AM, "llvm-dev on behalf of Dan Liew via llvm-dev" <llvm-dev-bounces at lists.llvm.org on behalf of llvm-dev at lists.llvm.org> wrote:

    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
    `LLVM_TOOL_<PROJECT>_BUILD` variables.
    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.
    LLVM Developers mailing list
    llvm-dev at lists.llvm.org

More information about the llvm-dev mailing list