<br><br><div class="gmail_quote">On Tue, May 3, 2011 at 4:15 PM, Tyler <span dir="ltr"><<a href="mailto:tyler@cryptio.net">tyler@cryptio.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
It doesn't work if you just include your icon file as one of the<br>
source files in the call to add_executable()/add_library()?<br>
<br>
What do you mean by "cross building"? Do you mean cross-compiling? If<br>
so, from what platform to win32?<br><br></blockquote><div><br></div><div>I'm compiling from linux to windows using the mingw32 compiler (on debian/ubuntu is packetized).</div><div><br></div><div>The tracker issue 0011773 is just about what you are saying, it's not enough to add the rc file to add_executable() to tell cmake to call the resource compiler.</div>
<div><br></div><div>After a few hours of unfruitful attempts I've solved with the following workaround:</div><div><br></div><div>I've added the following line to my "toolchain-mingw32.cmake":</div><div><br>
</div><div><div><b>SET(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>")</b></div></div><div><b><br></b></div><div>I also added in my CMakeLists.txt the following block:</div>
<div><br></div><div><div>if (WIN32)</div><div> ENABLE_LANGUAGE(RC)</div><div> set(SOURCES icon.rc ${SOURCES})</div></div><div>endif()</div><div><br></div><div>End of the workaround.</div><div><br></div><div>Please note that I had to remove <FLAGS> and <DEFINES> cause I found no way to avoid CXX defines to be mirrored also inside RC_FLAGS, here is a piece of my (autogenerated) flags.cmake:</div>
<div><br></div><div>RC_FLAGS = -I/home/gabry/projects/mlmonitor/common -I/home/gabry/projects/mlmonitor/build_w32/inc -I/usr/i586-mingw32msvc/include/gtk-2.0 -I/usr/i586-mingw32msvc/lib/gtk-2.0/include -I/usr/i586-mingw32msvc/include/atk-1.0 -I/usr/i586-mingw32msvc/include/cairo -I/usr/i586-mingw32msvc/include/pango-1.0 -I/usr/i586-mingw32msvc/include/glib-2.0 -I/usr/i586-mingw32msvc/lib/glib-2.0/include -I/usr/i586-mingw32msvc/include/libpng12 -I/home/gabry/projects/mlmonitor/client/oogtk -mms-bitfields</div>
<div><br></div><div>I had also to insert -O coff otherwise the linker failed the build that is strange because launching from the shell:</div><div><br></div><div>i586-mingw32msvc-windres icon.rc icon.o</div><div><br></div>
<div>Already creates a coff object...</div><div><br></div></div>-- <br>Bye,
<div> Gabry</div>