CMake does not find Visual C++ compiler

Asher picture Asher · Jul 24, 2015 · Viewed 204.9k times · Source

After installing Visual Studio 2015 and running CMake on a previous project, CMake errors stating that it could not find the C compiler.

The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:4 (PROJECT):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:4 (PROJECT):
  No CMAKE_CXX_COMPILER could be found.

I went searching for cl.exe in the Visual Studio folder,C:\Program Files\Microsoft Visual Studio 14.0, and could not find it.

How do I set up CMake to work on Windows with Visual Studio 2015?

Answer

Asher picture Asher · Jul 24, 2015

I have found the solution. While the Visual Studio IDE installed successfully it did not install any build tools and therefore did not install the C++ compiler.

By attempting to manually create a C++ project in the Visual Studio 2015 GUI I was able to prompt it to download the C++ packages. CMake was then able to find the compiler without any difficulty.