1
votes

I wish to generate a x64 project for Visual Studio with cmake. Unfortunately, cmake always generates x86 projects. The generator name I use is "Visual Studio 12 Win64". cmake is run from x64 VS developer console, yet still projects are generated for x86 and CMAKE_SIZEOF_VOID_P is always 4, not 8. There are no errors during project generation. Could this be a bug in cmake?

1
Actually I found it's a known bug: public.kitware.com/Bug/view.php?id=11240krojew
From my experience, the bug persists in MSVC12 (2013) too. If you don't encounter it, maybe it depends on a specific project configuration or worse, is nondeterministic.krojew
On my computer, the first configuration used determines the CMAKE_SIZEOF_VOID_P no matter what you set the generator to as long as you use the native compiler option. Deleting the Cache (through the CMake GUI) then deleting the CMakeFiles folder on the top level solved it for me, as it then searches for the native compilers using the new generator. I noticed this solution when I rechecked out code from version control and tried a different generator first, and it worked.Poik

1 Answers

-1
votes

For me determining the the size of a void pointer with cmake started to fail after I switched the MSBuild project output in Visual Studio 2010 from "Normal" to "Diagnostic". Everything worked fine again after switching back to "Normal".