Figure out which subprojects are enabled in downstream project

Is there a way to query from CMake whether LLVM was built with a specific subproject?

We have a downstream project that depends on a set of llvm subprojects, namely MLIR, Clang, and optionally compiler-rt. Some of our tests rely on clang having compiler-rt libraries to link again. So, when they are unavailable, we want to skip these tests.

Ideally, this subproject detection should be done in CMake to set up the lit test suite config accordingly. Unfortunately, LLVMConfig.cmake does not seem to provide such information, and we were not able to find any other place where this info would be available. Does anyone of you have an idea how this can be done cleanly?