diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 842c8016..ef308fc2 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -203,9 +203,38 @@ endif() if(NOT CMAKE_SYSTEM_ARCH) if(CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID) - set(CMAKE_SYSTEM_ARCH "${CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID}") + string(TOLOWER "${CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID}" CMAKE_SYSTEM_ARCH) + if(CMAKE_SYSTEM_ARCH STREQUAL "x86") + set(X86_32 TRUE) + elseif(CMAKE_SYSTEM_ARCH STREQUAL "x86_64" OR CMAKE_SYSTEM_ARCH STREQUAL "x64") + set(X86_64 TRUE) + set(CMAKE_SYSTEM_ARCH "x86_64") + elseif(CMAKE_SYSTEM_ARCH MATCHES "^(aarch.*|arm.*)") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(AARCH64 TRUE) + else() + set(ARM32 TRUE) + endif() + endif() elseif(CMAKE_ANDROID_ARCH_ABI) set(CMAKE_SYSTEM_ARCH "${CMAKE_ANDROID_ARCH_ABI}") + if(CMAKE_SYSTEM_ARCH STREQUAL "x86") + set(X86_32 TRUE) + elseif(CMAKE_SYSTEM_ARCH STREQUAL "x86_64") + set(X86_64 TRUE) + elseif(CMAKE_SYSTEM_ARCH MATCHES "^(aarch.*|AARCH.*|arm.*|ARM.*)") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(AARCH64 TRUE) + else() + set(ARM32 TRUE) + endif() + elseif(CMAKE_SYSTEM_ARCH MATCHES "^(mips|MIPS).*") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(MIPS64 TRUE) + else() + set(MIPS32 TRUE) + endif() + endif() elseif(CMAKE_COMPILER_IS_ELBRUSC OR CMAKE_COMPILER_IS_ELBRUSCXX OR CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ID STREQUAL "LCC" OR CMAKE_SYSTEM_PROCESSOR MATCHES "e2k.*|E2K.*|elbrus.*|ELBRUS.*")