[CMake] Visual Studio and Windows Mobile SDKs

Clemens Arth Clemens.Arth at gmx.at
Tue Jul 1 09:48:56 EDT 2008


Hi again,

ok, now I had a look at the cmake source code. My question is: "Has anyone really got a cross-compile setup running under Windows with VS?" There are some points which I've tried and I want to share my outcome with you:

First, I took a look at cmGlobalVisualStudio8Generator.cxx and at cmLocalVisualStudio7Generator.cxx. In both files, there is "Win32" hardcoded as platform name, but for some reason, there is also a SetPlatformName(...) function, which (in my opinion) is intended to be used for setting up another platform name - however, my tests have shown that this function is never called in my setup, even if I use some cross-compiler toolchain file. So I simply replaced "Win32" by "Windows Mobile 5.0 Pocket PC SDK (ARMV4I)", which is one of the correct targets in my setting, just to find out if that works - and it does! Now the correct compiler is used for compiling the test program, which still fails because of the already known "mainCRTStartup" error.

I further changed four files, namely CMakeTestCCompiler.cmake, CMakeTestCxxCompiler.cmake, CMakeCCompilerABI.cpp and CMakeCXXCompilerABI.cpp just to get the test program compiled (mainly replacing or augmenting the int main(...) template by another int mainCRTStartup() function). Now it finishes configuration without an error and creates my project files.

I started VS and tried to compile the outcoming solution. With setting up the different platform in cmGlobalVisualStudio8Generator.cxx and at cmLocalVisualStudio7Generator.cxx, VS now really takes the correct compiler, which is also reflected by the changes in the properties settings (being able to select switches like the /QRarch4 one now). However, there are two annoying things: first, the project always wants to link against winmm.lib, which I did not define anywhere and which causes the first linker error. Even worse, if I remove it manually, finally I end up with a linker error: "fatal error LNK1112: module machine type 'ARM' conflicts with target machine type 'X86'". Whatever I do, I could not manage to resolve that one.

That's the latest status of todays work. Coming back to my initial question if somebody got cross-compiling to work under VS: I think, calling SetPlatformName() during processing the cross-compiler toolchain file should be sufficient to run cmake without recompiling it from source. However, I'm not sure if this is possible, and I'd appreciate if someone would comment on that.

Regards
Clemens

-------- Original-Nachricht --------
> Datum: Tue, 1 Jul 2008 11:39:33 +0200
> Von: "Andreas Pokorny" <andreas.pokorny at gmail.com>
> An: "Clemens Arth" <Clemens.Arth at gmx.at>
> CC: cmake at cmake.org, a.neundorf-work at gmx.net
> Betreff: Re: [CMake] Visual Studio and Windows Mobile SDKs

> Hi Clemens,
> 
> 2008/7/1 Clemens Arth <Clemens.Arth at gmx.at>:
> > Hi again,
> >
> >> I took a look at your files and I think you have done a pretty good job
> >> and that should work out well. For some reason I had to force the
> compiler
> >> setting to be MSVC, because cmake did not set it automatically.
> >
> > I also had to force the CXX compiler setting to MSVC.
> >
> >> However, the linker returns an error for mobile 5 and 6:
> >>
> >> module machine type 'X86' conflicts with target machine type 'THUMB'
> >
> > Well, the main problem seems to be the fact, that after all the
> configuration stuff cmake still sticks to the usual x86 compiler for compiling the
> test program:
> 
> Could you check that the path to cl.exe or clarm.exe set inside the
> TOOLCHAIN File is correct?
> I do not know how cmake behaves when it cannot find the compiler. But
> accordung to the output,
> it looks like the normal windows cl compiler.
> 
> kind regards
> Andreas
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx


More information about the CMake mailing list