Hello,<div><br></div><div>That's not how Qt4 resources are added with CMake. Here you have a good explanation:</div><div><br></div><div><a href="http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake">http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake</a></div>
<div><br><br><div class="gmail_quote">On Mon, Jul 8, 2013 at 6:17 PM, Júlio Hoffimann <span dir="ltr"><<a href="mailto:julio.hoffimann@gmail.com" target="_blank">julio.hoffimann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Dear all,<div><br></div><div>I'm not that experienced with Qt, but I'm migrating an existing application to use CMake as the build system. It all worked smoothly, except the icons in the GUI aren't being shown.</div>
<div><br></div><div>Suppose I'm a directory named main/ that has a subdirectory named resources/pixmaps:</div><div><br></div><div>main/</div><div>-- resources/</div><div>-- -- pixmaps/</div><div>-- -- -- icon1.png</div>
<div>-- -- -- icon2.png</div><div><br></div><div>My CMakeLists.txt resides at main/. I also have an icons.qrc with the following content:</div><div><pre style="font-size:medium"><span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">RCC</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">qresource</span> <span style="color:rgb(39,71,150)">prefix</span><span style="color:rgb(128,128,48)">=</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(0,0,230)">/icons</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">file</span><span style="color:rgb(166,87,0)">></span>resources/pixmaps/icon1.png<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">file</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">file</span><span style="color:rgb(166,87,0)">></span>resources/pixmaps/icon2.png<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">file</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">qresource</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">RCC</span><span style="color:rgb(166,87,0)">></span></pre></div><div><br></div><div>I tried the following:</div><div><br></div><div>QT4_ADD_RESOURCES(lib_resources icons.qrc)</div>
<div>add_library(mylib ${lib_srcs} ${lib_resources})</div><div><br></div><div>Should I copy icons.qrc to the correspondent ${CMAKE_CURRENT_BINARY_DIR}? The paths in icons.qrc should be relative to what?</div><div><br></div>
<div>I have tried put @CMAKE_CURRENT_SOURCE_DIR@ in the icons.qrc entries and configure_file() it for getting absolute paths:</div><div><br></div><div><pre style="font-size:medium"><span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">RCC</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">qresource</span> <span style="color:rgb(39,71,150)">prefix</span><span style="color:rgb(128,128,48)">=</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(0,0,230)">/icons</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">file</span> <span style="color:rgb(39,71,150)">alias</span><span style="color:rgb(128,128,48)">=</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(0,0,230)">resources/pixmaps/icon1.png</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(166,87,0)">></span>@CMAKE_CURRENT_SOURCE_DIR@/resources/pixmaps/icon1.png<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">file</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"><</span><span style="color:rgb(95,80,53)">file</span> <span style="color:rgb(39,71,150)">alias</span><span style="color:rgb(128,128,48)">=</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(0,0,230)">resources/pixmaps/icon2.png</span><span style="color:rgb(0,0,230)">"</span><span style="color:rgb(166,87,0)">></span>@CMAKE_CURRENT_SOURCE_DIR@/resources/pixmaps/icon2.png<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">file</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">qresource</span><span style="color:rgb(166,87,0)">></span>
<span style="color:rgb(166,87,0)"></</span><span style="color:rgb(95,80,53)">RCC</span><span style="color:rgb(166,87,0)">></span></pre></div><div><br></div><div>but also didn't work.</div><div><br></div><div>I appreciate if you provide a minimal working example with best practices regarding CMake parallel builds. Perhaps a hello world example with an icon instead?</div>
<div><br></div><div>Best,</div><div>Júlio.</div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Pau Garcia i Quiles<br><a href="http://www.elpauer.org">http://www.elpauer.org</a><br>
(Due to my workload, I may need 10 days to answer)
</div>