[CMake] cmake on Windows x64

Gregory Peele ARA/VHD gpeele at ara.com
Mon Oct 15 13:29:21 EDT 2012


> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On
> Behalf Of John Drescher
> Sent: Monday, October 15, 2012 7:49 AM
> To: Yuri Timenkov
> Cc: cmake at cmake.org
> Subject: Re: [CMake] cmake on Windows x64
> 
> > Except that you have CMAKE_SYSTEM_PROCESSOR == "x86" (event for
> "Win64"
> > generators) in your CMake files along with all search paths which
> > sometimes very inconvenient.
> 
> I am not sure that has ever caused me a problem on any of the 64 bit
> applications I have written. The only problem I had with CMake was for
> a while my x64 applications were being installed (by nsis) in "Program
> Files (x86)" instead of "Program Files". I have since fixed my settings
> for NSIS and this has worked for over a year for me..
> 
> John

Having CMAKE_SYSTEM_PROCESSOR be "x86" for a 64-bit build is very inconvenient when detecting machine-dependent compiler flags, constructing directory names for outputs based on configuration, configuring third party search directories, etc.  It's always possible to work around (among other things, one can consult the generator string for Visual Studio builds, though not for MinGW builds) but that doesn't mean it shouldn't be better behaved - it's entirely reasonable to assume that CMAKE_SYSTEM_PROCESSOR should be the target processor for the build, especially so that you can have similar behavior on Windows, Linux, and Mac.  Though as previously discussed I also have the opposite problem on Linux when compiling for 32-bit CPU on 64-bit OS.

My workaround is to have my wrapper build scripts always set CMAKE_SYSTEM_PROCESSOR to the intended target (I also do lots of cross-compiling for ARM and MIPS) but this results in surprises for anyone who uses the CMake GUI directly, and makes CMake think it's cross compiling when it's not.

Gregory Peele, Jr.
Staff Software Engineer
Virtual Heroes - Orlando
Applied Research Associates, Inc.
+1 (407) 823-9121 x 840013



More information about the CMake mailing list