Merge pull request #664 from JeffProgrammer/apple-silicon-detection

Better Architecture detection strategy if compiling on Apple Silicon
This commit is contained in:
Jeff Hutchinson 2021-11-06 23:04:53 -04:00 committed by GitHub
commit af6037da7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -745,14 +745,13 @@ if (APPLE AND NOT IOS)
set(ARCHITECTURE_STRING_APPLE "x86_64;arm64")
set(DEPLOYMENT_TARGET_APPLE "10.13")
else()
check_c_compiler_flag("-arch arm64" armSupportedApple)
if(armSupportedApple)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(ARCHITECTURE_STRING_APPLE "arm64")
set(DEPLOYMENT_TARGET_APPLE "11.0")
else()
set(ARCHITECTURE_STRING_APPLE "x86_64")
set(DEPLOYMENT_TARGET_APPLE "10.9")
endif()
endif()
endif()
set(CMAKE_OSX_ARCHITECTURES ${ARCHITECTURE_STRING_APPLE} CACHE STRING "OSX Architecture" FORCE)