cmake在Windows XP中不起作用

我是新的cmake ,只是安装它,并遵循这篇文章:

http://www.cs.swarthmore.edu/~adanner/tips/cmake.php

 D:\Works\c\cmake\build>cmake .. -- Building for: NMake Makefiles 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 unknown -- The CXX compiler identification is unknown CMake Warning at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (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): D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE) CMakeLists.txt:2 (project) CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set CMAKE_RC_COMPILER to a valid compiler path or name. -- Check for CL compiler version -- Check for CL compiler version - failed -- Check if this is a free VC compiler -- Check if this is a free VC compiler - yes -- Using FREE VC TOOLS, NO DEBUG available -- Check for working C compiler: cl 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 D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (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): D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE) CMakeLists.txt:2 (PROJECT) CMake Error at D:/Tools/CMake 2.8/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): D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE) D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE) CMakeLists.txt:2 (PROJECT) CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Check for working C compiler: cl -- broken CMake Error at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): The C compiler "cl" 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) CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: your CXX compiler: "cl" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name. -- Configuring incomplete, errors occurred! 

什么是在Windows XP中成功使用cmake的完整要求?我已经在D:\Tools\Microsoft Visual Studio 9.0下安装了Visual Studio

Solutions Collecting From Web of "cmake在Windows XP中不起作用"

首先,我必须承认,我不知道cmake

要使用NMake生成器,cmake必须从可以使用命令行编译器cl的shell运行。 这个环境不包含INCLUDE,LIB或LIBPATH,并且这些必须被设置为让cl编译器工作。

上面的错误意味着Cmake找不到C / C ++编译器头文件和库的正确位置。

不要从命令提示符运行cmake,而是尝试从Visual Studio 2008命令提示符运行cmake。 您可以在开始>程序> Microsoft Visual Studio 2008> Visual Studio Tools )或文件夹* Microsoft Visual Studio 9.0 \ VC *中的vcvarsall.bat中找到它。 Visual Studio 2008命令提示符应自动为您设置所有这些环境变量,以便cmake知道在哪里可以找到所需的必要文件。

命令提示符将在Visual Studio文件夹中启动,因此您必须键入以下命令切换到源文件夹并启动cmake。

 D: cd D:\Works\c\cmake\build> cmake 

我希望这可以帮助你。

我有类似的问题在Win7上,并得到相同的错误 – C编译器“cl.exe”无法编译一个简单的测试程序。

为我工作的解决方案:

  1. 在Windows上不要在cygwin终端上运行cmake。

  2. 在命令提示符下运行它,同时确保你拥有管理员权限。在Windows 7中,你可以通过开始 – >所有程序 – >附件 – >(右键单击命令提示符)并选择“运行作为管理员“

然后运行'cmake <your source>'为我工作就像一个魅力。