Fixes the build on Gentoo Linux. On Gentoo Linux the user chooses which
llvm backend to build and install, therefore we need to loop over the
installed targets and append the libraries needed instead of relying on
the full list of supported backends.