Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
This commit only moves and renames methods. The code hasn't changed.
Fixes #7071.