SystemTools: add a clonefile optimization on macOS
Implement the copy file optimization on Darwin for copy_file
and
copy_file_if_different
. Use the copyfile
API on macOS 10.5 or
newer to copy the file using APFS clone semantics. This is a best
effort operation, but will fallback to copying without the cloning
if necessary. The operation has been available since 10.5, making
it old enough to assume present as the OS has been EOLed for years
now.
Ported from cmake/cmake!7325 (closed).
Author: @compnerd