VS 2010 和 CMake:'rc' 未被识别为内部或外部命令

VS 2010 and CMake: 'rc' is not recognized as an internal or external command

我正在尝试使用 VS 2010 和 CMake 在 Windows 10 - Home 上构建项目。 我收到以下错误:

zutil.c  
lib -nologo -out:zlib.lib adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj  gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj   

rc /dWIN32 /r /fozlib1.res ./win32/zlib1.rc   
'rc' is not recognized as an internal or external command,
operable program or batch file.   

NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.  
*.dll   
The system cannot find the file specified.
        0 file(s) copied.  

Setting environment for using Microsoft Visual Studio 2010 x86 tools.  
The system cannot find the file specified.  
-- The C compiler identification is MSVC 16.0.40219.1  
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe   
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken   

CMake Error at C:/Program Files (x86)/CMake/share/cmake3.6/Modules/CMakeTestCCompiler.cmake:61 (message):


The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
  10.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/Project/build/libpng-1.6.7-build/CMakeFiles/CMakeTmp

有谁知道原因是什么:

'rc' is not recognized as an internal or external command,
operable program or batch file."  

会是吗?

我假设这也会导致 cl.exe is broken 错误?

我上次遇到这个问题是在我的 Visual Studio 2012 Professional 标准安装没有安装任何 Windows SDK 时(错误日志显示缺少 SDK header)。

验证您的 SDK 安装,例如检查您是否安装了任何资源编译器。它应该在类似于以下的路径中:

C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe

由于我缺少这个 - 或者更准确地说是任何 SDK - 我安装了 Windows 8.1 SDK (since Visual Studio 2012 does target Windows 8.x) and voila my CMake was able again to compile the (test) programs. I think for Visual Studio 2010 the default would be the Windows 7.0a SDK and for Visual Studio 2015 it would be Windows 10 SDK with Universal C Runtime

参考