[CMake] Using cmake under windows

Yann Renard yann.renard.mailing-lists at tiscali.fr
Mon Aug 28 10:48:42 EDT 2006


Arjen Markus wrote:
>> typing 'set' at the windows prompt reports the variables to be set 
>> correctly.
>>
> Well, that at least is one thing.
> 
> What happens if you try to compile a small file by typing the compile
> cmmand used by TRY_COMPILE into a DOS box?
> Something like:
> 
> cl.exe -o tst.obj -c tst.c
> 
> Or alternatively, could you post the error output from the TRY_COMPILE
> command as found in the error log file?

I quickly wrote a 'hello world' program,
- compiled with :
'cl -c a.cpp'
- linked with :
'link a.obj -out:test.exe'

it works. However, I haven't explicitly requested 'user32.lib' here. So 
I tried this :
'link a.obj -out:test.exe user32.lib'

and it also works !

here is the error log for cmake (sorry it's mostly in french) :

> 2>------ Début de la génération : Projet : cmTryCompileExec, Configuration : Debug Win32 ------
> 2>Compilation en cours...
> 2>Compilateur d'optimisation Microsoft (R) 32ÿbits C/C++ versionÿ14.00.50727.42 pour 80x86
> 2>Copyright (C) Microsoft Corporation. Tous droits réservés.
> 2>cl /Od /D "_MBCS" /FD /EHsc /RTC1 /MDd /Fo"cmTryCompileExec.dir\Debug\\" /Fd"Debug/cmTryCompileExec.pdb" /W3 /c /Zi /TC    /DWIN32 /D_WINDOWS  /Zm1000   /D_DEBUG         -DCMAKE_INTDIR=\"Debug\"
> 2>   .\testCCompiler.c
> 2>testCCompiler.c
> 2>Compilation du manifeste en ressources en cours...
> 2>dition des liens en cours...
> 2>Microsoft (R) Incremental Linker Version 8.00.50727.42
> 2>Copyright (C) Microsoft Corporation.  All rights reserved.
> 2>"/OUT:Debug\cmTryCompileExec.exe" /INCREMENTAL /MANIFEST "/MANIFESTFILE:cmTryCompileExec.dir\Debug\cmTryCompileExec.exe.intermediate.manifest" /DEBUG "/PDB:Debug\cmTryCompileExec.pdb" /SUBSYSTEM:CONSOLE /STACK:10000000 /machine:I386 /debug kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib 
> 2>".\cmtrycompileexec.dir\debug\testCCompiler.obj" 
> 2>".\cmTryCompileExec.dir\Debug\cmTryCompileExec.exe.embed.manifest.res" 
> 2>LINK : fatal error LNK1104: impossible d'ouvrir le fichier 'user32.lib'
> 2>Le journal de génération a été enregistré à l'emplacement "file://d:\yrenard\OpenViBE\tmp\CMakeFiles\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm"
> 2>cmTryCompileExec - 1 erreur(s), 0 avertissement(s)
> ========== Génération : 1 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignor‚ ==========

Do you want the 'BuildLog.htm' file also ?

Eric said:
> "building platform sdk samples works correctly."
> What does it mean?
> Opening pre-prepared project file with VS is OK? 

no, the platform SDK comes with samples, each of them having a prepared 
makefile. Invoking 'nmake' in sample directories compiles and links the 
sample files properly, based on those makefiles.

Eric added:
> Lay be you should check what generator you try to use,
> even if I doubt you trouble is regarding generator since
> cmake seems to fail on SYSTEM Check.

true, I agree.

At least, Christian said:
> You did not run cmake / cmakesetup from the correct command prompt. Therefore your env vars 'LIB' and 'INCLUDE' are not set correct.
> Take a look into your start menu (PlatformSDK -> OpenBuildEnv Window -> ...) and don't open your command prompt by executing cmd.exe.

No, as I said before, typing 'set' at the command prompt reports 
correctly set environment variables. Do you think I missed something here ?

Best regards,
Yann Renard


More information about the CMake mailing list