Browse Source

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

Kolan Sh 2 years ago
parent
commit
5a8221f571
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      CPackDetectArch.cmake

+ 7
- 1
CPackDetectArch.cmake View File

@@ -9,11 +9,17 @@ SET (ARCHITECTURE "${CUSTOM_ARCHITECTURE}")
9 9
 IF (ARCHITECTURE STREQUAL "")
10 10
     # SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
11 11
     # SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}")
12
-    EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
12
+    IF (WIN32)
13
+        EXECUTE_PROCESS(COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
14
+    ELSE (WIN32)
15
+      EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
16
+    ENDIF (WIN32)
13 17
 
14 18
     # Replacements
15 19
     STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}")
20
+    STRING (REGEX REPLACE "MINGW64.*" "amd64" ARCHITECTURE "${ARCHITECTURE}")
16 21
     STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}")
22
+    STRING (REGEX REPLACE "MINGW32.*" "i386" ARCHITECTURE "${ARCHITECTURE}")
17 23
     STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}")
18 24
 
19 25
 ENDIF ()

Loading…
Cancel
Save