When using a customized Z3 installation via variable LLVM_Z3_INSTALL_DIR, the desired Z3 installation may not be used if the system has another installation. And if there is not a system-wide one, the compilation will stop when using llvm-tblgen, as the libz3.so cannot be found by the executable.
This patch tries to fix this problem by adding the customized Z3 install path to RPATH. And it will not be added if the system-wide installed version is used (variable LLVM_Z3_INSTALL_DIR is not set during cmake).