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.

https://llvm.org/docs/CMake.html#developing-llvm-passes-out-of-source

-Yuanfang

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

-Andrzej