2010-11-04 42 views
56

Tôi hiện đang cố gắng để có được CMake chạy trên hệ thống Windows 7 (64-bit) của tôi. Tôi muốn biên dịch TagLib để sử dụng sau này với ứng dụng Qt tôi đang làm việc. Tôi muốn biên dịch nó với MinGW (không phải Visual C++ như trong this other question).Chạy CMake trên Windows

Tôi tải xuống trình cài đặt (cmake-2.8.3-win32-x86.exe) và cài đặt (tôi cũng chọn thêm CMake vào đường dẫn của mình). Sau đó tôi đi đến thư mục tại sao tệp CMakeLists.txt là và chạy cmake .. Sau đó nó mang lại cho tôi lỗi khổng lồ này.

C:\Users\Joel\Downloads\taglib-1.6.3>cmake . 
CMake Warning at CMakeLists.txt:1 (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 C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake: 
28 (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): 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:60 (INCLUDE) 
    CMakeLists.txt:1 (project) 


CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set CMAKE_RC_COM 
PILER 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 C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake: 
28 (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): 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:60 (INCLUDE) 
    CMakeLists.txt:2 (PROJECT) 


CMake Error at C:/Program Files (x86)/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): 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:28 (ENABLE_LANG 
UAGE) 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:60 (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 C:/Program Files (x86)/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:1 (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 compi 
ler path or name. 
-- Configuring incomplete, errors occurred! 

C:\Users\Joel\Downloads\taglib-1.6.3> 

Tôi đã rất ngạc nhiên khi nó không thành công đến mức khó khăn, xem xét nó quảng cáo chính nó như một nền tảng.

Tôi đã thử đặt BAO GỒM, LIB và LIBPATH (biến môi trường Windows) vào thư mục nhị phân MinGW của tôi (C: \ MinGW \ bin) nhưng vẫn cho tôi lỗi tương tự. Tôi cũng đã thử đặt CMAKE_C_COMPILER và CMAKE_CXX_COMPILER thành vị trí của g ++ (C: \ MinGW \ bin \ g ++).

Có ai biết điều gì đang xảy ra ở đây không?

SOLUTION:

mỗi gợi ý Tibur, tôi chạy GUI cmake để tạo ra các tập tin làm. Tôi sau đó đi vào thư mục taglib thư mục và chạy mingw32-make.exe để thực hiện việc xây dựng thực tế.

Trả lời

82

Trình tạo mặc định cho Windows dường như được đặt thành NMake. Cố gắng sử dụng:

cmake -G "MinGW Makefiles" 

Hoặc sử dụng giao diện đồ họa, và chọn MinGW Makefiles khi nhắc cho một máy phát điện. Đừng quên dọn dẹp thư mục mà bạn đã cố gắng chạy cmake, hoặc xóa cache trên GUI. Nếu không, nó sẽ thử lại với NMake.

+1

Điều đó đã làm được điều đó. Cảm ơn đã giúp đỡ! –

+10

Bước tiếp theo là chạy 'mingw32-make.exe all' để thực hiện việc xây dựng thực tế. –

+1

+1 Tôi đã thiếu 'mingw32-make.exe' và được chào đón bởi trình biên dịch CXX không lành mạnh. Gnu Làm cho Windows không cắt nó, phiên bản MinGW là bắt buộc. – Vorac

13

Có một vcvars32.bat trong thư mục cài đặt VisualStudio của bạn. Bạn có thể thêm lệnh cmd.exe vào cuối chương trình batch đó và khởi động nó. Từ vỏ đó, bạn có thể sử dụng cmake hoặc cmake-gui và cl.exe sẽ được biết là cmake

+0

Để mã để thêm các cuộc gọi đến cmd.exe trong vcvars32/64.bat là: '@call" cmd.exe "' – NumesSanguis

Các vấn đề liên quan