2010-11-04 6 views
56

Attualmente sto cercando di far funzionare CMake sul mio sistema Windows 7 (64 bit). Voglio compilare TagLib per un uso successivo con un'applicazione Qt su cui sto lavorando. Mi piacerebbe compilarlo con MinGW (non Visual C++ come in this other question).Esecuzione di CMake su Windows

Ho scaricato il programma di installazione (cmake-2.8.3-win32-x86.exe) e l'ho installato (opto anche per aggiungere CMake al mio percorso). Quindi vado nella directory perché il file CMakeLists.txt è ed eseguo cmake .. Mi dà poi questo errore gigantesco.

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> 

Ero un po 'sorpreso dal fatto che non è riuscito così difficile, fuori dalla scatola, considerandolo si pubblicizza come un cross-platform make.

Ho provato a impostare INCLUDE, LIB e LIBPATH (variabili di ambiente Windows) tutti nella directory dei file binari MinGW (C: \ MinGW \ bin), ma continua a generare lo stesso errore. Ho anche provato a impostare CMAKE_C_COMPILER e CMAKE_CXX_COMPILER sulla posizione di g ++ (C: \ MinGW \ bin \ g ++).

Qualcuno sa cosa sta succedendo qui?

SOLUZIONE:

Per suggerimento di Tibur, ho eseguito il GUI CMake per creare i file make. Poi sono andato nella directory taglib della directory ed ho eseguito mingw32-make.exe per fare la build effettiva.

risposta

82

Il generatore predefinito per Windows sembra impostato su NMake. Prova ad utilizzare:

cmake -G "MinGW Makefiles" 

Oppure utilizzare la GUI, e selezionare MinGW Makefiles quando pronta per un generatore. Non dimenticare di pulire la directory in cui si è tentato di eseguire cmake o di eliminare la cache sulla GUI. Altrimenti, proverà di nuovo con NMake.

+1

Che l'ha fatto. Grazie per l'aiuto! –

+10

Il prossimo passo è eseguire 'mingw32-make.exe all' per fare la build effettiva. –

+1

+1 Mi mancava 'mingw32-make.exe' e sono stato accolto da un criptico compilatore CXX No sane. Gnu Make per Windows non lo taglia, è richiesta la versione MinGW. – Vorac

13

C'è un vcvars32.bat nella directory di installazione di VisualStudio. È possibile aggiungere la chiamata cmd.exe alla fine del programma batch e avviarla. Da quella shell è possibile utilizzare cmake o cmake-gui e cl.exe sarebbe noto per cmake

+0

Al codice per aggiungere la chiamata a cmd.exe nel file vcvars32/64.bat è: '@call" cmd.exe "' – NumesSanguis