only include necessary system libraries amongst each other based on explicit dependencies; fixes #2191