On Thursday 21 February 2013 20:46:14 Koller, Martin wrote:
> Hi all,
>
> I found an old cmake bug entry (see below) for the problem I have:
>
> I downloaded and installed the 32bit cmake exe on a 64bit windows
> and wanted to build our project as 64bit executable. However in our
> cmake files (which are used for Linux, Solaris, windows) we often check
> for the current processor architecture we build for as we need to link
> against external libraries which are stored in different subdirs etc.
>
> Problem is: as cmake is a 32bit exe, wincrap always returns a value
> of "x86" even on a 64bit machine as described here:
> http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
>
> In brief - they say to detect the current CPU shall be done as:
>
> IF PROCESSOR_ARCHITECTURE == amd64 OR
> PROCESSOR_ARCHITEW6432 == amd64 THEN
> // OS is 64bit
> ELSE
> // OS is 32bit
> END IF
>
> I think this should really be fixed in cmake directly to be able
> to use this cmake variable in a true platform independant way
> (at least it already works perfectly for all other platforms)
> and the cmake doc suggest that it tells me excactly that:
> "CMAKE_SYSTEM_PROCESSOR: The name of the CPU CMake is building for."
> which is not correct in this case.
>
> Shall I reopen this mantis task ?
>
> Old bug entry: http://public.kitware.com/Bug/view.php?id=9065
>
I propose the attached patch for CMakeDetermineSystem.cmake
Can someone add this to the mentioned mantis bug entry or shall I create a new
one ?
--
Best regards/Schöne Grüße
Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
This mail was not scanned before sending.
It was sent from a secure Linux desktop.
--- CMakeDetermineSystem.cmake.orig 2013-02-22 12:08:09.173459353 +0100
+++ CMakeDetermineSystem.cmake 2013-02-22 12:12:31.950448214 +0100
@@ -73,7 +73,13 @@
else()
if(CMAKE_HOST_WIN32)
set (CMAKE_HOST_SYSTEM_NAME "Windows")
- set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
+ # http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
+ if(("$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "amd64") OR
+ ("$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "amd64"))
+ set (CMAKE_HOST_SYSTEM_PROCESSOR "amd64")
+ else()
+ set (CMAKE_HOST_SYSTEM_PROCESSOR "x86")
+ endif()
endif()
endif()
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake