CMake -G Ninja on Windows specify x64

You have to set the compiler environment accordingly before calling Ninja generation. If you have Visual Studio 2013 installed at the standard installation path you call:

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
cmake.exe -G "Ninja" ..

Edit: Thanks for the hint from @Antwane: “Or simply run CMake command from a Microsoft Visual Studio Command Prompt (x64). A shortcut to this prompt is located in Start Menu”.

The naming varies over the Visual Studio versions:

enter image description here


When I then look into the generated CMakeCache.txt file I see:

...
//CXX compiler
CMAKE_CXX_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
...
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING= /machine:x64
...
//Path to a program.
CMAKE_LINKER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/link.exe
...

Leave a Comment

tech