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
This commit is contained in:
QiangZiBro
2023-03-30 02:56:18 +00:00
committed by PyTorch MergeBot
parent 1432a893ef
commit a95815c6b7

View File

@ -92,7 +92,7 @@ if(APPLE)
# Get clang version on macOS
execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string )
string(REGEX REPLACE "Apple LLVM version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string})
string(REGEX REPLACE "Apple (.*) version ([0-9]+\\.[0-9]+).*" "\\2" CLANG_VERSION_STRING ${clang_full_version_string})
message( STATUS "CLANG_VERSION_STRING: " ${CLANG_VERSION_STRING} )