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 ident
Those stumbling with this on Visual Studio 2017: there is a feature related to CMake that needs to be selected and installed together with the relevant compiler toolsets. See the screenshot below.
Because CMake is not able to find your Visual Studio compiler. Start any project which will download the required compilers and CMake must be able to find it then.
A couple of tips:
My problem was a combination of previously stated: I have set the compiler version to 15 instead of 14 and when corrected, I had to delete the cache.
I also started the Visual Studio command prompt as an administrator and from there I ran the cmake-gui.exe
Then everything worked as it was supposed to.
None of the previous solutions worked for me. However I noticed that although I installed Visual Studio version 15 (not to be confused with Visual Studio 2015) the directory created on my computer was for Visual Studio 14.
When I specified Visual Studio 14 when I pressed the configuration button it worked.
Check name folder too long or not.
In my case I could see in the CMakeError.log
that CMake could not find the Windows SDK (MSB8003: Could not find WindowsSDKDir variable from the registry
).
The version can be specified on the commandline on the first CMake run using:
-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=
I got further after setting that, but I hit more issues later (so I assume my environment is messed up somehow), but maybe it will help someone with this issue.