2010-11-04 26 views
56

Actualmente estoy tratando de ejecutar CMake en mi sistema Windows 7 (64 bits). Quiero compilar TagLib para usarlo más adelante con una aplicación Qt en la que estoy trabajando. Me gustaría compilarlo con MinGW (no con Visual C++ como en el this other question).Ejecutando CMake en Windows

Descargo el instalador (cmake-2.8.3-win32-x86.exe) y lo instalo (también opto por agregar CMake a mi ruta). Luego voy al directorio por qué el archivo CMakeLists.txt es y ejecuto cmake .. Entonces me da este error gigante.

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> 

Yo estaba un poco sorprendido de que no tan duro fuera de la caja, teniendo en cuenta que se anuncia como una marca multiplataforma.

Intenté configurar INCLUDE, LIB y LIBPATH (variables de entorno de Windows) todo en mi directorio de binarios MinGW (C: \ MinGW \ bin) pero todavía me da el mismo error. También intenté configurar CMAKE_C_COMPILER y CMAKE_CXX_COMPILER en la ubicación de g ++ (C: \ MinGW \ bin \ g ++).

¿Alguien sabe lo que está pasando aquí?

SOLUCIÓN:

Por sugerencia de Tibur, me encontré con la GUI cmake para crear los archivos de maquillaje. Luego fui al directorio taglib directorio y ejecuté mingw32-make.exe para hacer la compilación real.

Respuesta

82

El generador predeterminado para Windows parece establecerse en NMake. Trate de usar:

cmake -G "MinGW Makefiles" 

O utilizar la GUI y seleccione MinGW Makefile cuando la solicitud de un generador. No te olvides de limpiar el directorio donde intentaste ejecutar cmake, o eliminar la caché en la GUI. De lo contrario, volverá a intentar con NMake.

+1

Eso lo hizo. ¡Gracias por la ayuda! –

+10

El siguiente paso es ejecutar 'mingw32-make.exe all' para hacer la compilación real. –

+1

+1 Me faltaba 'mingw32-make.exe' y fui recibido por un críptico compilador CXX no cuerdo. Gnu Make para Windows no lo corta, se requiere la versión MinGW. – Vorac

13

Hay un vcvars32.bat en su dir de instalación de VisualStudio. Puede agregar la llamada cmd.exe al final de ese programa por lotes y ejecutarlo. Desde ese shell puede usar cmake o cmake-gui y cl.exe sería conocido por cmake

+0

Al código para agregar la llamada a cmd.exe en el vcvars32/64.bat es: '@call" cmd.exe "' – NumesSanguis

Cuestiones relacionadas