Hi,<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
</div>First of all, you definitely need the library target in order to build<br>
the library, and CMake ignores each file in the list of sources which<br>
is not necessary for this purpose. IMO, that&#39;s quite reasonable; e.g.,<br>
you wouldn&#39;t want to have the library relinked or even completely re-<br>
built because the manifest has been touched. Actually, there&#39;s simply<br>
no dependency of the library on the manifest. </blockquote><div><br></div><div>This makes sense, the dependency is the other way, from the bundle to the library. Until now I tried to see the manifest file as part of the target, but I could as well see it a separate step.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Furthermore, a TARGET-<br>
style custom command is triggered only when its target is rebuilt, so<br>
generating the ZIP file in this way is unsuitable since you will miss<br>
its dependency on the manifest. Thus, to express this dependency, you<br>
need to have an own target for the ZIP file, so you will end up with<br>
two targets if you want to have the dependencies set up correctly,<br>
although you&#39;d prefer to have just one. BTW, is this really bad?<br></blockquote><div><br></div><div>Reading the replies I think this might be the best solution. In this case I would like to be able to add dependencies to the top-level target, eg I would like to add my &quot;bundle&quot; targets to &quot;ALL&quot; since building the project implicitly means the bundles need to be generated.</div>
<div><br></div><div>Again, previously I tried to see the Manifest file as a part of the compilation unit. So a change to the file would trigger a rebuild of the library and zip file, instead of only the zip file.</div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Regards,<br>
<br>
Michael<br>
<div class="HOEnZb"><div class="h5"><br>
&gt;&gt; PS: Please don&#39;t drop the ML.<br>
&gt;&gt;<br>
&gt;<br>
&gt; I am used to mailing lists having the reply-to set, will try to keep it in<br>
&gt; mind.<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; 2011/12/13 Michael Hertling &lt;<a href="mailto:mhertling@online.de">mhertling@online.de</a>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 12/12/2011 11:40 AM, Alexander Broekhuis wrote:<br>
&gt;&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Can anyone help me with this? I haven&#39;t found a proper solution myself<br>
&gt;&gt;&gt;&gt; yet..<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Does the following examplary project do what you intend?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)<br>
&gt;&gt;&gt;&gt; PROJECT(P C)<br>
&gt;&gt;&gt;&gt; SET(CMAKE_VERBOSE_MAKEFILE ON)<br>
&gt;&gt;&gt;&gt; # The library target:<br>
&gt;&gt;&gt;&gt; FILE(WRITE ${CMAKE_BINARY_DIR}/f.c &quot;void f(void){}\n&quot;)<br>
&gt;&gt;&gt;&gt; ADD_LIBRARY(f SHARED f.c)<br>
&gt;&gt;&gt;&gt; # The README file:<br>
&gt;&gt;&gt;&gt; FILE(WRITE ${CMAKE_BINARY_DIR}/README &quot;Very important information!\n&quot;)<br>
&gt;&gt;&gt;&gt; # The ZIP file command:<br>
&gt;&gt;&gt;&gt; ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/f.zip<br>
&gt;&gt;&gt;&gt;    COMMAND zip -j ${CMAKE_BINARY_DIR}/f.zip<br>
&gt;&gt;&gt;&gt;                   ${CMAKE_BINARY_DIR}/README<br>
&gt;&gt;&gt;&gt;                   $&lt;TARGET_FILE:f&gt;<br>
&gt;&gt;&gt;&gt;    DEPENDS ${CMAKE_BINARY_DIR}/README)<br>
&gt;&gt;&gt;&gt; # The ZIP file target:<br>
&gt;&gt;&gt;&gt; ADD_CUSTOM_TARGET(zip ALL DEPENDS ${CMAKE_BINARY_DIR}/f.zip)<br>
&gt;&gt;&gt;&gt; # Trigger ZIP file target after library target:<br>
&gt;&gt;&gt;&gt; ADD_CUSTOM_COMMAND(TARGET f POST_BUILD<br>
&gt;&gt;&gt;&gt;    COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/f.zip<br>
&gt;&gt;&gt;&gt;    COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}<br>
&gt;&gt;&gt;&gt;                             --config $&lt;CONFIGURATION&gt;<br>
&gt;&gt;&gt;&gt;                             --target zip)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; The basic idea is the decomposition of the ZIP file&#39;s generation into a<br>
&gt;&gt;&gt;&gt; custom target, an OUTPUT-style custom command and a TARGET-style custom<br>
&gt;&gt;&gt;&gt; command, the latter in conjunction with CMake&#39;s --build switch.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Regards,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Michael<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; 2011/12/8 Alexander Broekhuis &lt;<a href="mailto:a.broekhuis@gmail.com">a.broekhuis@gmail.com</a>&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Hi all,<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; In my project, some top level targets depend on simple text files.<br>
&gt;&gt; These<br>
&gt;&gt;&gt;&gt;&gt;&gt; targets produce a zip file as output, this is done using a custom<br>
&gt;&gt;&gt;&gt; command<br>
&gt;&gt;&gt;&gt;&gt;&gt; with a post-build to a library target.<br>
&gt;&gt;&gt;&gt;&gt;&gt; Part of the zip file are some simple text files, which are included<br>
&gt;&gt;&gt;&gt; using<br>
&gt;&gt;&gt;&gt;&gt;&gt; some custom CPack handling inside the custom command.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; How can I let the top level target depend on these text files as well?<br>
&gt;&gt;&gt;&gt; In<br>
&gt;&gt;&gt;&gt;&gt;&gt; other words, if a text files changes, the zip file has to be<br>
&gt;&gt;&gt;&gt; regenerated.<br>
&gt;&gt;&gt;&gt;&gt;&gt; These text files are not generated or copied etc. So a simple DEPENDS<br>
&gt;&gt;&gt;&gt; would<br>
&gt;&gt;&gt;&gt;&gt;&gt; suffice. I know add_custom_command(OUTPUT has support for this, but am<br>
&gt;&gt;&gt;&gt;&gt;&gt; wondering how to do this with add_custom_command(TARGET.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; TiA!<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt;&gt; Met vriendelijke groet,<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Alexander Broekhuis<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Met vriendelijke groet,<br><br>Alexander Broekhuis<br>