CMake: Fix building x86 on Apple Silicon

This commit is contained in:
User 2023-12-30 16:53:39 +10:00 committed by Connor McLaughlin
parent 0784b5930b
commit 8e5fc236ca
1 changed files with 4 additions and 1 deletions

View File

@ -92,9 +92,12 @@ if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_HOST_SYSTEM_PR
if (DISABLE_ADVANCE_SIMD)
add_compile_options("-msse" "-msse2" "-msse4.1" "-mfxsr")
else()
# Can't use march=native on Apple Silicon.
if(NOT APPLE OR "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
add_compile_options("-march=native")
endif()
endif()
endif()
else()
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()