properly detect processor architecture on Windows

CMake is usually run as a 32 bit process even on 64 bit Windows, so the
PROCESSOR_ARCHITECTURE environment variable would always return x86. This post
gives a description on how to do it properly:

http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
This commit is contained in:
Rolf Eike Beer 2013-02-25 16:14:36 +01:00
parent e597ba2928
commit add8d22acc
1 changed files with 5 additions and 1 deletions

View File

@ -73,7 +73,11 @@ if(CMAKE_HOST_UNIX)
else()
if(CMAKE_HOST_WIN32)
set (CMAKE_HOST_SYSTEM_NAME "Windows")
set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
if (ENV{PROCESSOR_ARCHITEW6432})
set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}")
else()
set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
endif()
endif()
endif()