cmake 在 Windows XP 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2709108/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cmake doesn't work in windows XP
提问by Gtker
I'm new with cmake
,just installed it and following this article:
我是新来的cmake
,刚刚安装了它并遵循这篇文章:
http://www.cs.swarthmore.edu/~adanner/tips/cmake.php
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!
What are the complete requirement to use cmake
successfully in windows XP?I've already installed Visual Studio under D:\Tools\Microsoft Visual Studio 9.0
cmake
在 windows XP 中成功使用的完整要求是什么? 我已经在下面安装了 Visual StudioD:\Tools\Microsoft Visual Studio 9.0
采纳答案by anonymous
First of all, I have to confess that I don't know cmake.
首先,我必须承认我不知道cmake。
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.
要使用 NMake 生成器,cmake 必须从可以从命令行使用编译器 cl 的 shell 运行。此环境不包含 INCLUDE、LIB 或 LIBPATH,必须设置这些才能使 cl 编译器正常工作。
The error above means that the proper locations to your C/C++ compiler's headers and libraries could not be found by cmake.
上面的错误意味着 cmake 无法找到 C/C++ 编译器的头文件和库的正确位置。
Instead of running cmake from the Command Prompt, try running cmake from the Visual Studio 2008 Command Prompt. You can find it under Start > Programs > Microsoft Visual Studio 2008 > Visual Studio Tools) or vcvarsall.batin the folder *Microsoft Visual Studio 9.0\VC*. The visual Studio 2008 Command Prompt should set all these environment variables for you automatically so that cmake knows where to find the necessary files that it needs.
不要从命令提示符运行 cmake,而是尝试从Visual Studio 2008 命令提示符运行 cmake 。您可以在“开始”>“程序”>“Microsoft Visual Studio 2008”>“Visual Studio 工具”下找到它,或者在文件夹 *Microsoft Visual Studio 9.0\VC* 中的vcvarsall.bat下找到它 。Visual Studio 2008 命令提示符应该自动为您设置所有这些环境变量,以便 cmake 知道在哪里可以找到它需要的必要文件。
The Command Prompt will start in your Visual Studio folder, so you'll have to type the following commands to switch to your source folder and start cmake.
命令提示符将在您的 Visual Studio 文件夹中启动,因此您必须键入以下命令才能切换到源文件夹并启动 cmake。
D:
cd D:\Works\c\cmake\build>
cmake
I hope this helps you.
我希望这可以帮助你。
回答by Dennis Mathews
I had similar issues on Win7, and was getting the same error - The C compiler "cl.exe" is not able to compile a simple test program.
我在 Win7 上遇到了类似的问题,并且遇到了同样的错误 - C 编译器“cl.exe”无法编译一个简单的测试程序。
The solution that worked for me :
对我有用的解决方案:
On Windows Donot run cmake on the cygwin terminal.
Run it from the command prompt, AND also ensure that you have admin rights, In windows 7 you can start command prompt as administrator by going to Start->All programs->Accessories-> (Right Click on Command Prompt) and Select "Run as administrator"
在 Windows 上不要在 cygwin 终端上运行 cmake。
从命令提示符运行它,并确保您具有管理员权限,在 Windows 7 中,您可以通过转到开始->所有程序->附件->(右键单击命令提示符)并选择“运行”来以管理员身份启动命令提示符作为管理员”
Then run 'cmake <your source>'
Worked like a charm for me.
然后运行'cmake <your source>'
对我来说就像一个魅力。