CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found.

在用cmkae生成makefile文件过程中执行命令:

cmake .. -G"NMake Makefiles"(此处针对的CMakeLists.txt在上一级目录)

时总是提示如下错误信息:

CMake Warning at CMakeLists.txt:2 (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.


-- The C compiler identification is MSVC 15.0.30729.1
-- The CXX compiler identification is MSVC 15.0.30729.1
CMake Warning at C:/Program Files/CMake/share/cmake-2.8/Modules/Platform/Windows
-MSVC.cmake:58 (enable_language):
  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.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-2.8/Modules/Platform/Windows-MSVC-C.cmake:1
 (include)
  C:/Program Files/CMake/share/cmake-2.8/Modules/CMakeCInformation.cmake:56 (inc
lude)
  CMakeLists.txt:2 (project)


CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found.   Ple
ase set CMAKE_RC_COMPILER to a valid compiler path or name.
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio 9.0/VC
/bin/cl.exe
CMake Warning at CMakeLists.txt:2 (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.


CMake Warning at C:/Program Files/CMake/share/cmake-2.8/Modules/Platform/Windows
-MSVC.cmake:58 (enable_language):
  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.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-2.8/Modules/Platform/Windows-MSVC-C.cmake:1
 (include)
  C:/Program Files/CMake/share/cmake-2.8/Modules/CMakeCInformation.cmake:56 (inc
lude)
  CMakeLists.txt:2 (PROJECT)


CMake Error at C:/Program Files/CMake/share/cmake-2.8/Modules/CMakeRCInformation
.cmake:22 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-2.8/Modules/Platform/Windows-MSVC.cmake:58
(enable_language)
  C:/Program Files/CMake/share/cmake-2.8/Modules/Platform/Windows-MSVC-C.cmake:1
 (include)
  C:/Program Files/CMake/share/cmake-2.8/Modules/CMakeCInformation.cmake:56 (inc
lude)
  CMakeLists.txt:2 (PROJECT)


CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio 9.0/VC
/bin/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-2.8/Modules/CMakeTestCCompiler
.cmake:61 (message):
  The C compiler "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin/cl.exe"
  is not able to compile a simple test program.

  It fails with the following output:





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "F:/calcOql/build/CMakeFiles/CMakeOutput.log".
See also "F:/calcOql/build/CMakeFiles/CMakeError.log".

经过查找发现这个错误的原因是由于:环境变量信息不正确导致的,所以在执行命令行之前先配置环境变量信息即可,即执行如下命令:

call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvas32.bat"
来设置环境变量即可,之后执行命令:

cmake .. -G"NMake Makefiles"
nmake
即可完成目标文件的生成。

参考链接:http://stackoverflow.com/questions/4101456/running-cmake-on-windows。


你可能感兴趣的:(CI(持续集成))