2010-11-04 11 views
56

Ich versuche derzeit CMake auf meinem Windows 7 (64-Bit) -System laufen zu lassen. Ich möchte TagLib für die spätere Verwendung mit einer Qt-Anwendung, an der ich arbeite, kompilieren. Ich möchte es mit MinGW kompilieren (nicht Visual C++ wie in this other question).Running CMake unter Windows

Ich lade das Installationsprogramm (cmake-2.8.3-win32-x86.exe) herunter und installiere es (ich entscheide mich auch, CMake zu meinem Pfad hinzuzufügen). Ich gehe dann zu dem Verzeichnis, warum die CMakeLists.txt-Datei ist und cmake . ausführen. Es gibt mir dann diesen Riesenfehler.

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> 

Ich war ziemlich überrascht, dass es so schwer, aus dem Kasten heraus versagt, es bewirbt sich als Cross-Plattform-Make berücksichtigen.

Ich habe versucht, INCLUDE, LIB und LIBPATH (Windows-Umgebungsvariablen) alle in mein MinGW-Binärdateien-Verzeichnis (C: \ MinGW \ bin) zu setzen, aber es gibt mir immer noch den gleichen Fehler. Ich habe auch versucht, CMAKE_C_COMPILER und CMAKE_CXX_COMPILER auf den Speicherort von g ++ (C: \ MinGW \ bin \ g ++) zu setzen.

Weiß jemand, was hier vor sich geht?

LÖSUNG:

Per tibur Vorschlag, lief ich die cmake GUI die make-Dateien zu erstellen. Ich ging dann in das Verzeichnis taglib Verzeichnis und lief mingw32-make.exe, um den tatsächlichen Build zu tun.

Antwort

82

Der Standardgenerator für Windows scheint auf NMake eingestellt zu sein. Versuchen Sie zu verwenden:

cmake -G "MinGW Makefiles" 

Oder die GUI verwenden, und wählen Sie MinGW Makefiles wenn Aufforderung für einen Generator. Vergessen Sie nicht, das Verzeichnis zu bereinigen, in dem Sie versucht haben, Cmake auszuführen, oder den Cache auf der GUI zu löschen. Andernfalls wird es erneut mit NMake versuchen.

+1

Das tat es. Danke für die Hilfe! –

+10

Der nächste Schritt ist, 'mingw32-make.exe all' auszuführen, um den eigentlichen Build zu machen. –

+1

+1 Ich vermisste 'mingw32-make.exe' und wurde von einem kryptischen No-Sane-CXX-Compiler begrüßt. Gnu Make für Windows schneidet nicht ab, die MinGW-Version ist erforderlich. – Vorac

13

In Ihrem VisualStudio-Installationsverzeichnis befindet sich eine Datei "vcvars32.bat". Sie können den Aufruf cmd.exe am Ende dieses Batch-Programms hinzufügen und starten. Von dieser Shell können Sie cmake oder cmake-gui verwenden und cl.exe würde bekannt sein, um zu cmake

+0

Um den Aufruf der cmd.exe in der vcvars32/64.bat hinzuzufügen, ist: "@call" cmd.exe "' – NumesSanguis