Support MSVC without any Windows SDK installed
Reproduce:
- Clean Win 10 Pro install (likely reproducible on other Windows as well)
- Install VS2015 with a minimum C++ Install: Select "Visual C++ => Common Tools for Visual C++ 2015". I did not select anything else. This is sufficient to install
cl.exe
and successfully build C++ apps with the VS2015 IDE. - Run cmake on any toy project, with default generator or
-G Visual Studio 14 2015
, with or without Win64. The command will fail with with an error no C and CXX compiler found. Further inspection ofCMakeError.log
shows that the problem is a missingrc.exe
,LINK : fatal error LNK1158: cannot run 'rc.exe'
. See the full log attached. (Note that the log shows CMake 3.6.3 but it occurs on 3.7.1 too.).
Of course it also fails when running CMake from the "VS2015 x64 Native Tools Command Prompt". Indeed rc.exe is the Resource Compiler and seems to be only installed by a Windows SDK.
Fix:
Re-run the VS2015 installer and install "Windows 10 SDK (10.0.10586)".
I believe this to be a bug since CMake should work when the C++ compiler cl.exe is present - even when it is a minimal VS installation that only contains the C++ compiler. After all, this is a valid VS2015 installation selection, and one can build C++ apps in the VS2015 IDE without any problems with this installation.