[CMake] Cross compiling from linux to windows using wine-based visual studio compilers

Daniel Russel drussel at gmail.com
Tue Oct 16 00:02:39 EDT 2012


I'm trying to get cross compilation of a simple library working to build a windows library on a linux box using the visual studio compilers. So far the farthest I've gotten is with:

./cmake-2.8.9-Linux-i386/bin/cmake ../rmf -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=/usr/bin/cl -DCMAKE_CXX_COMPILER=/usr/bin/w32cc -DCMAKE_RC_COMPILER=/bin/true

You can find the cmake output at <https://gist.github.com/3897173>. Basically, it seems to partly figure out the compilers, but then tries to test cl by passing the source file using "-c" and a unix path, both of which cl drops on the floor. The command is
 /usr/bin/cl /nologo /DWIN32 /D_WINDOWS /W3 /Zm1000 /D_DEBUG /MDd /Zi /Ob0
  /Od /RTC1 /FoCMakeFiles/cmTryCompileExec3161846472.dir/testCCompiler.c.obj
  /Fd/synth1/home/drussel/rmf-build/CMakeFiles/CMakeTmp/cmTryCompileExec3161846472.pdb
  -c /synth1/home/drussel/rmf-build/CMakeFiles/CMakeTmp/testCCompiler.c

This is using the build of cmake 2.8.9 for linux i386 downloaded from the kitware site.

The RC compiler bit is a suggestion I found while searching around as cmake demanded an RC compiler, which I don't think will get used. But better suggestions are welcome. 

Thanks for any suggestions.
        --Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121015/e5730c40/attachment-0001.htm>


More information about the CMake mailing list