fix 32bit intel detection for 32bit mxe target

mxe leaves CMAKE_SYSTEM_PROCESSOR empty, so detect if mxe is being used
and set the variable based on CMAKE_TOOLCHAIN_FILE, this allows the
32bit asm to compile under mxe.

Also if no toolchain file is being used and CMAKE_SYSTEM_PROCESSOR is
empty, fall back to CMAKE_HOST_SYSTEM_PROCESSOR.
This commit is contained in:
Rafael Kitover 2017-03-08 15:49:00 -08:00
parent 687c08a051
commit 7b0baadbaa
1 changed files with 13 additions and 1 deletions

View File

@ -24,8 +24,20 @@ option( ENABLE_NLS "Enable translations" ON )
SET(ASM_DEFAULT OFF) SET(ASM_DEFAULT OFF)
IF(NOT CMAKE_SYSTEM_PROCESSOR)
IF(NOT CMAKE_TOOLCHAIN_FILE AND CMAKE_HOST_SYSTEM_PROCESSOR)
SET(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
ELSEIF(CMAKE_TOOLCHAIN_FILE MATCHES mxe)
IF(CMAKE_TOOLCHAIN_FILE MATCHES "i[3-9]86")
SET(CMAKE_SYSTEM_PROCESSOR i686)
ELSE()
SET(CMAKE_SYSTEM_PROCESSOR x86_64)
ENDIF()
ENDIF()
ENDIF()
# turn asm on by default on 32bit x86 # turn asm on by default on 32bit x86
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|[aA][mM][dD]64|[xX]64") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
IF(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit IF(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
SET(ASM_DEFAULT ON) SET(ASM_DEFAULT ON)
SET(X86_32 ON) SET(X86_32 ON)