Fix for 0013574: Ninja: no transitive dependency for imported libraries

This is a quick-and-dirty fix for issue [13574](http://public.kitware.com/Bug/view.php?id=13574). Suggestions for improvement would be most welcome!

Cheers,
Nick