【问题标题】:cmake doesn't work in windows XPcmake 在 Windows XP 中不起作用
【发布时间】:2011-02-12 03:20:59
【问题描述】:

我是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

【问题讨论】:

  • 幸运的是,现在有更好的选择来为 .NET 构建 DSL 语言,比如一个名为 FAKE 的库。

标签: windows configuration cmake


【解决方案1】:

我在 Win7 上遇到了类似的问题,并且遇到了同样的错误 - C 编译器“cl.exe”无法编译简单的测试程序。

对我有用的解决方案:

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

  2. 从命令提示符运行它,并确保您具有管理员权限,在 Windows 7 中,您可以通过转到开始->所有程序->附件->(右键单击命令)以管理员身份启动命令提示符提示)并选择“以管理员身份运行”

然后运行 ​​'cmake <your source>' 对我来说就像一个魅力。

【讨论】:

    【解决方案2】:

    首先,我不得不承认我不知道cmake

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

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

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

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

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

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-29
      • 2012-04-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多