I'm working on a project that uses LLVM and LLD, which are stored in separate remote repositories (https://git.llvm.org/git/llvm, https://git.llvm.org/git/lld). To build LLD, it must be cloned inside of LLVM, where the LLVM build system will detect its presence and generate build targets for it (documentation). Precisely:
LLD_CLONE_DIR = LLVM_CLONE_DIR/tools/lld
I would like to use git submodules, and invoke git submodule update --init --recursive
(during CMake configuration).
I've found that git doesn't handle putting one submodule inside another submodule, for instance:
[submodule "contrib/llvm/tools/lld"]
path = contrib/llvm/tools/lld
url = https://git.llvm.org/git/lld
[submodule "contrib/llvm"]
path = contrib/llvm
url = https://git.llvm.org/git/llvm
I thought of making my build script construct a symlink, but it's unreliable on some platforms (Windows). How can I structure the directories so that the LLVM build system will be happy, but I can use git submodules to clone both repositories?
Update: I've succesfully used CMake's file command to copy the lld sources to the correct location. I'm still interested in a better solution though.