[CMake] Cross compiling using MSVC via wine on linux

Stefan Buschmann s_buschmann at gmx.de
Sat Jan 6 06:03:34 EST 2007


Hi all

This is one more question about how to get cmake doing cross compile 
jobs. I know there isn't direct support for it yet, but it would be nice 
if it would somehow be possible to do that with cmake.

I'm setting up a make system for a fairly large project (game engine) 
with cmake, and for the linux builds everything works really fine. But 
now I would also like to do the compilation of the linux and windows 
build on a daily base on the same machine, so cross compiling becomes 
necessary. It would not be too hard to do this with mingw, but most 
users of the engine will use VC and there seem to be some problems 
sharing dll/lib files between compilers (and the project has many 
dependencies), so I want to use VC7 with wine to compile the project. 
VC7 via wine is already working nice, and I can already compile the 
project by hand without any problems.

Now for the cmake part: To compile the project for windows, it would be 
necessary to tell cmake to use the VC compiler (and therefore using the 
VC compiler flags and setting standard compiler options). I tried to do 
this by including Platform/Windows-cl directly, which gave me some VC 
compiler flags but everything else is still gcc style. As I looked at 
the cmake sources, I realized that all "windows"-Generators are only 
compiled in for a win32 build itself, so I guess all VC related 
functions are in there and not in the cmake files, so they don't seem to 
be available on linux.

Would it be possible to seperate platform and compiler informations, so 
that I could tell cmake to use VC compiler options even though we are 
currently running on a linux machine? Or, for the beginning, could I 
write a new generator that produces standard linux make files but use VC 
compiler options on a linux machine? I guess this shouldn't be too hard, 
as all needed functionality is already there but simply not being made 
available on the desired system.

Any pointers on where to start for that?

Stefan



More information about the CMake mailing list