Fix architecture detection when MinGW is 32 while host is 64.

This commit is contained in:
Kolan Sh 2016-08-22 21:27:33 +03:00
parent ad6da89892
commit 5a8221f571
1 changed files with 7 additions and 1 deletions

View File

@ -9,11 +9,17 @@ SET (ARCHITECTURE "${CUSTOM_ARCHITECTURE}")
IF (ARCHITECTURE STREQUAL "") IF (ARCHITECTURE STREQUAL "")
# SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") # SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
# SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}") # SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}")
IF (WIN32)
EXECUTE_PROCESS(COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
ELSE (WIN32)
EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE) EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
ENDIF (WIN32)
# Replacements # Replacements
STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}") STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "MINGW64.*" "amd64" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}") STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "MINGW32.*" "i386" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}") STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}")
ENDIF () ENDIF ()