Minor cmake fixes
Fixes fetching submodules from non-default branches.
Various CheckSubmodules fixes Closes #3992, #3993, #3994
Custom CMake module which attempts to automatically clone submodules when they're missing. Uses the `--depth` option if supported, which should be faster than running `--recursive` on initial clone.