The great thing is that cross compiling was very simple with to setup with CMake in my case,&nbsp; I didn't&nbsp; require a &quot;special&quot; CMakeLists.txt.<br><br>All I do is create a file e.g. &quot;setmingw&quot; with:<br><br>
export CC=i586-mingw32msvc-gcc<br>export CXX=i586-mingw32msvc-g++<br>export LD=i586-mingw32msvc-ld<br>export AR=i586-mingw32msvc-ar<br>export AS=i586-mingw32msvc-as<br>export NM=i586-mingw32msvc-nm<br>export STRIP=i586-mingw32msvc-strip
<br>export RANLIB=i586-mingw32msvc-ranlib<br>export DLLTOOL=i586-mingw32msvc-dlltool<br>export OBJDUMP=i586-mingw32msvc-objdump<br>export RESCOMP=i586-mingw32msvc-windres<br>export CFLAGS=<br><br>then a <br>% source setmingw
<br>% cmake<br>% make<br><br>Unfortunately the command SET_TARGET_PROPERTIES( ...) doesn't solve the library problem, linking against the library will result in <br>&quot;cannot find -lexample.dll&quot;<br>(here the dll suffix is to much)
<br>The thing that works is renaming the libraries e.g. libexample.so to example.dll<br><br>I wasn't aware that CMake does not support cross-compiling. Apart from linking against the library with the correct prefix/suffix it works in my case. Also I didn't know the option CROSS_MINGW32, however it setting the option doesn't solve the problem.
<br><br>Thanks for your help,<br><br>Peter.<br><br><br><div><span class="gmail_quote">On 11/16/06, <b class="gmail_sendername">Eric Noulard</b> &lt;<a href="mailto:eric.noulard@gmail.com">eric.noulard@gmail.com</a>&gt; wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I am really interested in getting sample CMakeLists.txt<br>since I just wanted to do what you've done, 
i.e. cross-compiling<br>for win32 under linux.<br><br>You should know that CMake does not currently support cross-compiling.<br>See<br><a href="http://www.cmake.org/pipermail/cmake/2006-September/010959.html">http://www.cmake.org/pipermail/cmake/2006-September/010959.html
</a><br>or<br><a href="http://www.cmake.org/pipermail/cmake/2006-September/010946.html">http://www.cmake.org/pipermail/cmake/2006-September/010946.html</a><br><br>For your &quot;problem&quot; I think you may try this in your
<br>project CMakeLists.txt<br><br>IF (UNIX)<br>&nbsp;&nbsp;&nbsp;&nbsp;IF (CROSS_MINGW32)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET(MY_TARGETLIB_PREFIX &quot;&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET(MY_TARGETLIB_SUFFIX &quot;.dll&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;ELSE (CROSS_MINGW32)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET(MY_TARGETLIB_PREFIX &quot;lib&quot;)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET(MY_TARGETLIB_SUFFIX &quot;.so&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;ENDIF (CROSS_MINGW32)<br>ENDIF (UNIX)<br><br>I assume<br>OPTION(CROSS_MINGW32&nbsp;&nbsp;&quot;Cross compile Win32 using mingw32&quot; OFF)<br><br>was set ON for mingw32 cross compiling
<br>and OFF for Linux &quot;native&quot; compiling.<br><br>Then use your MY_TARGETLIB_xxx<br>in all other places:<br>SET_TARGET_PROPERTIES(ex1<br>&nbsp;&nbsp; PROPERTIES<br>&nbsp;&nbsp; PREFIX $(MY_TARGETLIB_PREFIX)<br>&nbsp;&nbsp; SUFFIX $(MY_TARGETLIB_SUFFIX)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br><br>2006/11/16, Peter Visser &lt;<a href="mailto:pervulgo@gmail.com">pervulgo@gmail.com</a>&gt;:<br>&gt;&nbsp;&nbsp;Hi,<br>&gt;<br>&gt;&nbsp;&nbsp;I have a working build under win32 with MSYS/MINGW, now I would like to
<br>&gt; cross-compile code for win32 with mingw from linux with by using the same<br>&gt; CMakelists.txt files. It almost works, the problem is that the shared<br>&gt; libraries are not named &quot;myex.dll&quot; but &quot;
libmyex.so&quot;. By using the following<br>&gt; command for all the libraries it can be solved:<br>&gt;<br>&gt;&nbsp;&nbsp;SET_TARGET_PROPERTIES(ex1<br>&gt;<br>&gt; PROPERTIES PREFIX &quot;&quot;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SUFFIX
<br>&gt; &quot;.dll&quot;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br>&gt;<br>&gt;&nbsp;&nbsp;However, now I have to change the CMakelist.txt in all the subdirectories<br>&gt; and lose the ability to compile natively for linux (without adding an
<br>&gt; IF(UNIX) around the SET_TARGET_PROPERTIES).<br>&gt;<br>&gt;&nbsp;&nbsp;Is there a global option to set the PREFIX and SUFFIX, set the BUILD_TARGET<br>&gt; to win32 or something alike?<br>&gt;<br>&gt;&nbsp;&nbsp;I tried setting:<br>&gt;
<br>&gt;&nbsp;&nbsp;SET(UNIX FALSE)<br>&gt;&nbsp;&nbsp;SET(MINGW TRUE)<br>&gt;&nbsp;&nbsp;SET(WIN32 TRUE)<br>&gt;<br>&gt;&nbsp;&nbsp;But that doesn't help.<br>&gt;<br>&gt;&nbsp;&nbsp;Any help is appreciated,<br>&gt;<br>&gt;&nbsp;&nbsp;Peter.<br>&gt; _______________________________________________
<br>&gt; CMake mailing list<br>&gt; <a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br>&gt;<br>&gt;<br><br>
<br>--<br>Erk<br>_______________________________________________<br>CMake mailing list<br><a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br><a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake
</a><br></blockquote></div><br>