6

I'm using a cmake file(someone else wrote it) to build a project. I looked at the CMakeLists and saw he used

if( CMAKE_SIZEOF_VOID_P EQUAL 8 )

to detect if the system is 64 bit. I'm using 64 bit windows 8 and it should be built into a 64 bit project. Why do I end up having a 32 bit project? Is there any other thing I should do?

user2390930
  • 137
  • 1
  • 2
  • 10

1 Answers1

24

When you invoke CMake, specify Win64 in the generator option. e.g.:

cmake . -G"Visual Studio 11 Win64"
Fraser
  • 74,704
  • 20
  • 238
  • 215
  • At the new cmake version it is not possible to specify win64 like this. I think it generates project files according to which command prompt it is run at, x64 or x86.. – phoad Dec 30 '13 at 01:17
  • 1
    This is still valid as of the current version (2.8.12.1) – Fraser Dec 30 '13 at 01:23
  • 4
    You can use the `CMAKE_VS_PLATFORM_NAME` variable to check the invoked generator platform, e.g. `x64` or `Win32`. – schletti2000 Nov 18 '15 at 17:46