[CMake] Fix detection of x86_64 platform with MSVC
authorparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Sep 2013 13:25:14 +0000 (13:25 +0000)
committerparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Sep 2013 13:25:14 +0000 (13:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116662

Reviewed by Gyuyoung Kim.

Use ${MSVC_CXX_ARCHITECTURE_ID} instead of ${CMAKE_SYSTEM_PROCESSOR}, since
the later one just resolves to the host processor on Windows.

* CMakeLists.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154978 268f45cc-cd09-0410-ab3c-d52691b4dbfc

CMakeLists.txt
ChangeLog

index 281f94a..1982744 100644 (file)
@@ -67,17 +67,23 @@ find_package(Ruby 1.8.7)
 # -----------------------------------------------------------------------------
 # Determine the target processor
 # -----------------------------------------------------------------------------
-string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
+# Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined,
+# since the later one just resolves to the host processor on Windows.
+if (MSVC_CXX_ARCHITECTURE_ID)
+    string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
+else ()
+    string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
+endif ()
 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
     set(WTF_CPU_ARM 1)
 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
     set(WTF_CPU_MIPS 1)
-elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
+elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
     set(WTF_CPU_X86_64 1)
 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
     set(WTF_CPU_X86 1)
 else ()
-    message(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
+    message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
 endif ()
 
 # -----------------------------------------------------------------------------
index 35f38ed..14cb35e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-09-03  Patrick Gansterer  <paroga@webkit.org>
+
+        [CMake] Fix detection of x86_64 platform with MSVC
+        https://bugs.webkit.org/show_bug.cgi?id=116662
+
+        Reviewed by Gyuyoung Kim.
+
+        Use ${MSVC_CXX_ARCHITECTURE_ID} instead of ${CMAKE_SYSTEM_PROCESSOR}, since
+        the later one just resolves to the host processor on Windows.
+
+        * CMakeLists.txt:
+
 2013-08-29  Sam Weinig  <sam@webkit.org>
 
         Add ENABLE guards for Promises