ExternalProject: Move more internal commands out of main file

The commands moved to shared_internal_commands.cmake
will soon be used directly by FetchContent, which cannot
always include the full ExternalProject.cmake file (e.g. it may
be used in CMake script mode).

Issue: #21703
9 files changed