diff options
author | Zachary Turner <zturner@google.com> | 2017-09-12 23:32:34 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-09-12 23:32:34 +0000 |
commit | f733fd2a32c12ba90f32399dd4cf43af2b25d1ad (patch) | |
tree | 94488a03bcde537158e4cb0462b966cac32ba5c2 /CMakeLists.txt | |
parent | 1bcbb0776c0e890fd3d043322f63d1d99f7357ca (diff) |
Determine up front which projects are enabled.
Some projects need to add conditional dependencies on other projects.
compiler-rt is already doing this, and I attempted to add this to
debuginfo-tests when I ran into the ordering problem, that you can't
conditionally add a dependency unless that dependency's CMakeLists.txt
has already been run (which would allow you to say if (TARGET foo).
The solution to this seems to be to determine very early on the entire
set of projects which is enabled. This is complicated by the fact that
there are multiple ways to enable projects, and different tree layouts
(e.g. mono-repo, out of -tree, external, etc). This patch attempts to
centralize all of this into one place, and then updates compiler-rt to
demonstrate as a proof of concept how this can simplify code.
Differential Revision: https://reviews.llvm.org/D37637
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d08fd67ddaf..cdeaf4ac706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -823,6 +823,25 @@ endif() include(AddLLVM) include(TableGen) + +# Find all subprojects which are either enabled in a side-by-side layout, or +# cloned into a non-side-by-side layout. Do this before adding any +# subdirectories so that any project can check for the existence of any other +# project. Each call takes priority over the next call, so any project which +# is enabled via LLVM_ENABLE_PROJECTS will not have its location or enabled +# status overwritten via a subsequent call. + +# First look for all projects explicitly enabled at the root. +find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/.." "${LLVM_ENABLE_PROJECTS}") + +# Then pick up any projects explicitly cloned into llvm/projects or llvm/runtimes +find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/runtimes") +find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/projects") + +# Then pick up a few specific projects which can be explicit cloned into llvm/tools +find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/tools" "clang;lldb;lld") + + if( MINGW ) # People report that -O3 is unreliable on MinGW. The traditional # build also uses -O2 for that reason: |