fix compiler version detection on MacOS (#97883)
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 43c1df6</samp>
Fix build error on macOS with Xcode 12 or newer by updating clang version detection in `CMakeLists.txt`.
Fixes https://github.com/pytorch/pytorch/issues/97882
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97883
Approved by: https://github.com/malfet