[CMake] cmake 2.5 with windows mobile

Artur Wisz wisz at bury.com
Fri Aug 31 12:12:00 EDT 2007


Hello dear CMake Users and Maintainers,

we would like to use CMake in our project, but one of the required 
platform is Windows Mobile 5.0. Unfortunately, CMake does not support 
this platform "out of the box". I know CMake supports cross-compiling 
now and is extensible, so I want to devote some time and try to write 
additional platform modules. However, I am sure some guidance from the 
CMake developers would save me lots of time. I will describe what I did 
to make a simple Makefile for nmake.
I am using the Visual Studio 2005 and the Windows Mobile 5 SDK 
integrates with it.
Normally I have to run the vcvarsall.bat or use the VS 2005 Command 
Prompt. Before running nmake, I have to set some environment variables:

set PATH=c:\Program files\Microsoft Visual Studio 
8\VC\ce\bin\x86_arm\;%PATH%
set INCLUDE=C:\Program files\Windows CE Tools\wce500\Windows Mobile 5.0 
Pocket PC SDK\Include\Armv4i;C:\Program files\Microsoft Visual Studio 
8\VC\ce\atlmfc\include;C:\Program files\Microsoft Visual Studio 
8\VC\ce\include
set LIB=C:\Program files\Microsoft Visual Studio 
8\VC\ce\lib\armv4i;C:\Program files\Windows CE Tools\wce500\Windows 
Mobile 5.0 Pocket PC SDK\Lib\ARMV4I

After this I can run nmake. A sample working makefile for a Debug build 
is given below.

There are 3 processor architectures supported: arm, mips, sh, which 
translate to VC\ce\bin subdirectories: x86_arm, x86_mips, x86_sh; but at 
the moment ARM is the one we are using.

I tried to hook up a custom platform file for cmake, but once the VS 
Command Prompt is used, it always wants to detect the compiler by 
building CMakeCCompilerId.c and running it, which fails, as it is a 
cross-compilation. I guess much of the Windows-cl.cmake could be reused 
for Windows Mobile.
So could anyone help me and give some hints how this could be done ? I 
would like to start with NMake Makefiles first.
Any answers will be well appreciated.
Regards,

Art

############# Makefile.ce ############

CFLAGS = /Od /Os /D OSAL_BUILD_DLL  /D _MSV_VER=1400 /D "_DEBUG" /D 
"_WIN32_WCE=0x501" /D "UNDER_CE" \
             /D "WIN32_PLATFORM_PSPC" /D "WINCE" /D "DEBUG" /D 
"_WINDOWS" /D "_USRDLL" /D "ARM" /D "_ARM_" /D "_UNICODE" \
             /D "UNICODE" /D "_WINDLL" /Gm /EHsc /MTd /fp:fast /GR /W3 
/nologo /c /Zi /TP
LIBS = coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib

CPPFLAGS  = $(CFLAGS)

OSALINC = /I./

O = WM5PPC-Debug\

OUTPUTDLL = $(O)\osal.dll
OUTPUTLIB = $(O)\osal.lib 

LFLAGS =  /NOLOGO /DLL /MANIFEST:NO /NODEFAULTLIB:"oldnames.lib" \
                  /DEBUG /ERRORREPORT:PROMPT /subsystem:windowsce,5.01

COMPL = $(CPP) $(CPPFLAGS) $(OSALINC) /Fo$@ $**
   
   
OBJS = $O\osal.obj $O\sharedmem.obj $O\systeminfo.obj $O\semaphore.obj
         
all: $(OUTPUTDLL)

$(OUTPUTDLL): $OUTDIR $(OBJS)
    link $(LFLAGS) /OUT:$(OUTPUTDLL) /IMPLIB:$(OUTPUTLIB) $(OBJS) $(LIBS)


$OUTDIR:
    if not exist "$O" mkdir "$O"
   
$(OBJS): src/$(*B).cpp
    $(COMPL)




More information about the CMake mailing list