I wanted to add some custom tool in bootstrap build before runtimes are started to be built.
I added the tool to both lists LLVM_ENABLE_PROJECTS and LLVM_ALL_PROJECTS to be build together with llvm, clang and lld.
But I cannot guarantee that is it built before runtimes start, like it is for clang and lld.
Is there any dedicated place in CMake infrastructure where dependencies between tools and runtimes are established?
The logic for setting up the CMake sub-configure for the runtimes build lives in llvm-project/CMakeLists.txt at main · llvm/llvm-project · GitHub, which calls out to llvm-project/LLVMExternalProjectUtils.cmake at main · llvm/llvm-project · GitHub. Search for
TOOLCHAIN_TOOLS in the second file to see the default logic for making the runtimes build depend on certain tools, which you could tweak to add your custom tool. You can also modify the first file to pass a custom
TOOLCHAIN_TOOLS list instead if that works better for you.
Thanks for the hint!
I extended population of the ARG_TOOLCHAIN_TOOLS list with the tool in file mentioned by you https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/LLVMExternalProjectUtils.cmake file.
And it works