Building LLVM runtimes as part of larger CMake project

We use compiler-rt/libunwind/libcxxabi/libcxx in a bare-metal project. Currently we build the runtime libraries as part of building our Docker toolchain environment, but it’s burdensome to update things like build flags as everything gets rebuilt. What’s the best/intended way for projects to directly build and link against the LLVM runtime libraries?

An obvious first attempt is to use ExternalProject_Add, passing in the toolchain file and additional flags as requred.

A solution using add_subdirectory would be ideal, as that better integrates with IDEs and build instrumentation. It also gives us more levers to improve binary size, build times etc.

There is documentation for consuming LLVM:
https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project

The last resort is forking LLVM and integrating your project into the build system.

There are already embedded projects using the llvm-libc.