Improved dependency build robustness.

May require clearing CMake caches. Recommend deleting old dependency builds, since the directory structure has changed.