2010-11-04 5 views
56

J'essaie actuellement de faire fonctionner CMake sur mon système Windows 7 (64 bits). Je veux compiler TagLib pour une utilisation ultérieure avec une application Qt sur laquelle je travaille. Je voudrais le compiler avec MinGW (pas Visual C++ comme dans this other question). Je télécharge l'installateur (cmake-2.8.3-win32-x86.exe) et l'installe (j'opte aussi pour ajouter CMake à mon chemin). Je vais ensuite dans le répertoire pourquoi le fichier CMakeLists.txt est et exécute cmake .. Cela me donne alors cette erreur géante. J'étais un peu surprisExécution de CMake sous Windows

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> 

qu'il n'a pas si dur de la boîte, en le considérant comme la publicité se faire multiplateformes.

J'ai essayé de paramétrer INCLUDE, LIB et LIBPATH (variables d'environnement Windows) dans mon répertoire de fichiers binaires MinGW (C: \ MinGW \ bin) mais cela me donne toujours la même erreur. J'ai également essayé de définir CMAKE_C_COMPILER et CMAKE_CXX_COMPILER à l'emplacement de g ++ (C: \ MinGW \ bin \ g ++).

Est-ce que quelqu'un sait ce qui se passe ici?

SOLUTION:

par la suggestion de Tibur, je courais le GUI cmake pour créer les fichiers make. Je suis ensuite allé dans le répertoire répertoire taglib et a couru mingw32-make.exe pour faire la construction réelle.

Répondre

82

Le générateur par défaut pour Windows semble être défini sur NMake. Essayez d'utiliser:

cmake -G "MinGW Makefiles" 

Ou utiliser l'interface graphique, et sélectionnez MinGW Makefiles quand invite pour un générateur. N'oubliez pas de nettoyer le répertoire dans lequel vous avez essayé d'exécuter cmake, ou supprimez le cache sur l'interface graphique. Sinon, il va essayer à nouveau avec NMake.

+1

Cela l'a fait. Merci pour l'aide! –

+10

L'étape suivante consiste à exécuter 'mingw32-make.exe all' pour faire la compilation proprement dite. –

+1

+1 Il me manquait 'mingw32-make.exe' et a été accueilli par un compilateur cryptique non SXX. Gnu Make pour Windows ne le coupe pas, la version MinGW est requise. – Vorac

13

Il existe un fichier vcvars32.bat dans votre répertoire d'installation VisualStudio. Vous pouvez ajouter appel cmd.exe à la fin de ce programme de traitement par lots et le lancer. De ce shell, vous pouvez utiliser cmake ou cmake-gui et cl.exe serait connu pour cmake

+0

Pour le code pour ajouter l'appel à cmd.exe dans le fichier vcvars32/64.bat est: '@call" cmd.exe "' – NumesSanguis

Questions connexes