Use target libraries instead of host libraries. Fixes #11243