Why do we require `-DLLVM_ENABLE_RUNTIMES` to build explicit target runtimes

Only specifying -DLLVM_RUNTIME_TARGETS and the corresponding -DRUNTIMES_$target_LLVM_ENABLE_RUNTIMES=compiler-rt does not create runtime build targets. You also have to specify -DLLVM_ENABLE_RUNTIMES=compiler-rt. This is confusing and pretty hard to fix if you don’t already know the solution. Is there a reason for this?

e.g. cmake -GNinja -DRUNTIMES_i386-unknown-linux-gnu_LLVM_ENABLE_RUNTIMES=compiler-rt -DLLVM_RUNTIME_TARGETS=i386-unknown-linux-gnu -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='clang' -DLLVM_ENABLE_LLD=ON ../../llvm doesn’t create runtimes targets.

@petrhosek

That’s just a relic of the runtimes build evolution. Initially, it was only possible to specify LLVM_ENABLE_RUNTIMES for the top-level build, but we later realized that it should be possible to also specify it in the sub-build since not every target may want to enable the same set of runtimes so we extended the runtimes build to allow specifying LLVM_ENABLE_RUNTIMES in the sub-build, but we still rely on the top-level LLVM_ENABLE_RUNTIMES to create build targets. I agree that this is confusing and we should address this.