LLVM Plugin Built Outside of Source Tree

Is there documentation anywhere for building an LLVM plugin (for a custom optimization pass) outside of LLVM’s source tree (as seems to be the case in http://llvm.org/docs/WritingAnLLVMPass.html).

For example, building it using an existing pre-installed LLVM?

This is the guide I followed quite a while ago.



Some out-of-source examples based on LLVM-8: