2010-11-04 10 views
56

Obecnie próbuję uzyskać CMake uruchomić na moim systemie Windows 7 (64-bit). Chcę skompilować TagLib do późniejszego wykorzystania z aplikacją Qt, nad którą pracuję. Chciałbym skompilować go z MinGW (nie Visual C++ jak w this other question).Uruchamianie CMake na Windows

Pobieram instalator (cmake-2.8.3-win32-x86.exe) i instaluję go (również dodaję CMake do mojej ścieżki). Następnie przechodzę do katalogu, dlaczego plik CMakeLists.txt jest i uruchamiam cmake .. To daje mi ten gigantyczny błąd.

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> 

Byłem trochę zaskoczony, że tak się nie udało, ponieważ reklamuje się jako marka wieloplatformowa.

Próbowałem ustawić INCLUDE, LIB i LIBPATH (zmienne środowiska Windows) w moim katalogu binarnym MinGW (C: \ MinGW \ bin), ale nadal daje mi ten sam błąd. Próbowałem również ustawić CMAKE_C_COMPILER i CMAKE_CXX_COMPILER na lokalizację g ++ (C: \ MinGW \ bin \ g ++).

Czy ktoś wie, co się tutaj dzieje?

ROZWIĄZANIE:

Za sugestią Tibur za pobiegłem cmake GUI do tworzenia plików wykonania. Potem poszedłem do katalogu taglib i uruchomiłem mingw32-make.exe, aby wykonać rzeczywistą kompilację.

Odpowiedz

82

Domyślny generator dla systemu Windows wydaje się być ustawiony na NMake. Spróbuj użyć:

cmake -G "MinGW Makefiles" 

Albo używać GUI i wybierz MinGW Makefile gdy Monit o generatorze. Nie zapomnij wyczyścić katalogu, w którym próbowałeś uruchomić cmake, lub usuń pamięć podręczną w interfejsie GUI. W przeciwnym razie spróbuje ponownie za pomocą NMake.

+1

To się udało. Dzięki za pomoc! –

+10

Następnym krokiem jest uruchomienie 'mingw32-make.exe all' do wykonania rzeczywistej kompilacji. –

+1

+1 Brakowało mi 'mingw32-make.exe' i zostałem powitany przez tajemniczy kompilator CXX. Gnu Make for Windows go nie tnie, wymagana jest wersja MinGW. – Vorac

13

W katalogu instalacyjnym VisualStudio znajduje się plik vcvars32.bat. Możesz dodać wywołanie cmd.exe na końcu tego programu wsadowego i uruchomić go. Z tej powłoki możesz użyć cmake lub cmake-gui, a cl.exe będzie znać cmake

+0

Do kodu, aby dodać wywołanie cmd.exe w pliku vcvars32/64.bat: "@call" cmd.exe "' – NumesSanguis

Powiązane problemy