<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">The paths should be relative to the
folder where your qrc file reside. Then you can use<br>
<br>
<div>QT4_ADD_RESOURCES(lib_resources icons.qrc)</div>
<div>add_library(mylib ${lib_srcs} ${lib_resources})</div>
<br>
<br>
On 08.07.2013 18:17, Júlio Hoffimann wrote:<br>
</div>
<blockquote
cite="mid:CAFRVdT9C55_drJfYU3s=QwhFQUEwg50aJpOFsY8ESibhYn=64w@mail.gmail.com"
type="cite">
<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="color:rgb(0,0,0);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="color:rgb(0,0,0);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>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a></pre>
</blockquote>
<br>
</body>
</html>