2010-04-25 86 views
8

我是新與cmake工作,只是安裝了它,本文以下內容:cmake的無法在Windows XP

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 ?我已經安裝了Visual Studio的D:\Tools\Microsoft Visual Studio 9.0

+0

幸運的是,現在有更好的選擇爲.NET構建DSL語言,就像名爲FAKE的庫。 – 2017-07-25 19:27:18

回答

8

首先,我必須承認我不知道cmake

要使用NMAKE發生器,cmake的 必須從可以使用 編譯器CL從命令 線的殼中運行。此環境不包含INCLUDE,LIB或LIBPATH, ,並且這些必須設置爲cl 編譯器才能正常工作。

上面的錯誤意味着cmake無法找到C/C++編譯器頭文件和庫的正確位置。

而不是從命令提示符運行cmake,請嘗試從Visual Studio 2008命令提示符運行cmake。您可以在文件夾* Microsoft Visual Studio 9.0 \ VC *中的開始>程序> Microsoft Visual Studio 2008> Visual Studio Tools)或vcvarsall.bat找到它。 visual Studio 2008命令提示符應自動爲您設置所有這些環境變量,以便cmake知道在哪裏可找到所需的必需文件。

命令提示符將在您的Visual Studio文件夾中啓動,因此您必須鍵入以下命令切換到源文件夾並啓動cmake。

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

我希望這可以幫助你。

+0

我想更新並補充說,這適用於VC 2010 – crockpotveggies 2012-05-25 08:27:41

0

我在Win7上遇到類似的問題,並且得到相同的錯誤 - C編譯器「cl.exe」無法編譯一個簡單的測試程序。

爲我工作的解決方案:

  1. 在Windows DONOT運行cmake cygwin的終端上。

  2. 在命令提示符下運行,並確保您有管理員權限,在Windows 7中,你可以通過進入開始 - 啓動命令提示符以管理員身份 - >所有程序 - >附件 - >(右鍵單擊命令提示符)並選擇「以管理員身份運行」

然後運行'cmake <your source>'就像我的魅力一樣工作。