2013-02-22 27 views
0

我試圖使用CMake的與Windows下的代碼塊的代碼在代碼塊。CMake的窗戶

內Cygwin的控制檯我做的:

cmake .. -G"CodeBlocks - Unix Makefiles" 

和輸出是:

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. 
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. 
Missing variable is: 
CMAKE_C_COMPILER_ENV_VAR 
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. 
Missing variable is: 
CMAKE_C_COMPILER 
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeCCompiler.cmake 
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. 
Missing variable is: 
CMAKE_CXX_COMPILER_ENV_VAR 
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. 
Missing variable is: 
CMAKE_CXX_COMPILER 
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeCXXCompiler.cmake 
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage 
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage 
-- Configuring incomplete, errors occurred! 

我試圖設置這些問題的變量,但結果是一樣的:

set CMAKE_MAKE_PROGRAM=C:/Progra~2/CodeBlocks/MinGW/bin/mingw32-make.exe 
set CMAKE_C_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe 
set CMAKE_CXX_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe 

任何想法如何使其工作?

編輯:添加路徑編譯器可以幫助,但還有一個錯誤:

-- The C compiler identification is unknown 
-- The CXX compiler identification is unknown 
-- Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32 
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe 
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken 
CMake Error at /usr/share/cmake-2.8.9/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): 
    The C compiler "C:/Program Files (x86)/Microsoft Visual Studio 
    10.0/VC/bin/cl.exe" is not able to compile a simple test program. 

    It fails with the following output: 

    Change Dir: /cygdrive/d/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeTmp 

    Run Build Command:C:/Program\ Files\ 
    (x86)/CodeBlocks/MinGW/bin/mingw32-make.exe 
    "cmTryCompileExec437970983/fast" 

    C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make -f 
    CMakeFiles/cmTryCompileExec437970983.dir/build.make 
    CMakeFiles/cmTryCompileExec437970983.dir/build 

    /usr/bin/sh: -c: line 0: Erreur de syntaxe près du symbole inattendu « (
    » 

    /usr/bin/sh: -c: line 0: `C:/Program Files 
    (x86)/CodeBlocks/MinGW/bin/mingw32-make -f 
    CMakeFiles/cmTryCompileExec437970983.dir/build.make 
    CMakeFiles/cmTryCompileExec437970983.dir/build' 

    mingw32-make: *** [cmTryCompileExec437970983/fast] Error 1 

    CMake will not be able to correctly generate this project. 
Call Stack (most recent call first): 

-- Configuring incomplete, errors occurred! 

回答

0

確保與編譯器(MinGW的-gcc.exe或類似的東西)的目錄在PATH,後再次啓動控制檯並嘗試再次運行cmake。

+0

謝謝,這有助於避免第一個錯誤,而是一個新的人來(見原始消息,評論中的字符有限,難以把它放在這裏) – Ote 2013-02-22 16:36:33

+0

爲什麼你設置你的編譯器爲CL?它不應該是gcc嗎?或者如果你使用的是爲什麼你不使用Visual Studio? – ixSci 2013-02-22 17:14:43

+0

因爲我不喜歡的Visual Studio,但我需要使用相同的編譯器爲我的球隊。但開始懷疑我想要的是否可能... – Ote 2013-02-24 19:55:16

2

也許你安裝了「MinGW的安裝管理器」的「基本設置」。因爲它沒有安裝GNU C++編譯器與包的名字 - 「MinGW的-GCC-G ++」你應該選擇它的「本」和「開發」,並手動安裝。這對我有效。