Q:

CMake android NDK project in Windows with toolchain file

I´m trying to run CMake from a Windows machine to generate an Android NDK project with a specific toolchain file. There is a tutorial on how to generate Android projects with CMake by google. Anyway I need the project to be an Eclipse project because its the only way to import it into ADT bundle. Now on the CMake UI there are more option for that:

Eclipse CDT4 - MinGW
Eclipse CDT4 - NMake
Eclipse CDT4 - Unix
Eclipse CDT4 - Ninja

The 2nd one (Eclipse CDT - NMake) is the right choice for this configuration, when i start CMake then it fail generating throwing following error:
CMake Warning at CMakeLists.txt:3 (project):
  To use the NMake generator, cmake must be run from a shell that can use the
  compiler cl from the command line.  This environment does not contain
  INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
  work.

any ideas?

A:

You need to initialize the environment with vcsvarsall.bat(shipped with Visual Studio).
E.g. for Microsoft Visual Studio 2010 - run this "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" in the same console instance where you intend to execute your cmake command:
...>"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" 
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

Or find in Start Menu  "Visual Studio Command Prompt (2010)" ("Developer Command Prompt for VS20XX" for recent versions of VS) which does this initialization for you and run cmake there.

