我是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
答案 0 :(得分:8)
首先,我必须承认我不知道 cmake 。
使用NMake生成器,cmake 必须从可以使用的shell运行 来自命令的编译器cl 线。这种环境没有 包含INCLUDE,LIB或LIBPATH, 并且必须为cl设置这些 编译器工作。
上述错误意味着cmake无法找到C / C ++编译器头文件和库的正确位置。
不是从命令提示符运行cmake,而是尝试从 Visual Studio 2008命令提示符运行cmake。你可以在开始>下找到它。节目> Microsoft Visual Studio 2008>文件夹* Microsoft Visual Studio 9.0 \ VC *中的Visual Studio工具)或 vcvarsall.bat 。 visual Studio 2008命令提示符应自动为您设置所有这些环境变量,以便cmake知道在哪里可以找到所需的必要文件。
命令提示符将在Visual Studio文件夹中启动,因此您必须键入以下命令才能切换到源文件夹并启动cmake。
D:
cd D:\Works\c\cmake\build>
cmake
我希望这会对你有所帮助。
答案 1 :(得分:0)
我在Win7上遇到了类似的问题,并且得到了同样的错误 - C编译器“cl.exe”无法编译简单的测试程序。
对我有用的解决方案:
在Windows上,Donot在cygwin终端上运行cmake。
从命令提示符运行它,并确保您拥有管理员权限。在Windows 7中,您可以通过转到开始 - >所有程序 - >附件 - >以管理员身份启动命令提示符。 (右键单击命令提示符)并选择“以管理员身份运行”
然后运行'cmake <your source>'
对我来说就像一个魅力。