[TargetDependency] Sorting recursively may lead to stack overflow.

In this case two targets depend on each other, which lead them to
endlessly sort each other. While it’s probably not helpful to have a
dependency loop to start with, it should not lead Xcodeproj to crash.

Fixes CocoaPods/CocoaPods#1384