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's quite reasonable; e.g.,<br>
you wouldn't want to have the library relinked or even completely re-<br>
built because the manifest has been touched. Actually, there'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'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 "bundle" targets to "ALL" 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>
>> PS: Please don't drop the ML.<br>
>><br>
><br>
> I am used to mailing lists having the reply-to set, will try to keep it in<br>
> mind.<br>
><br>
><br>
>><br>
>>> 2011/12/13 Michael Hertling <<a href="mailto:mhertling@online.de">mhertling@online.de</a>><br>
>>><br>
>>>> On 12/12/2011 11:40 AM, Alexander Broekhuis wrote:<br>
>>>>> Hi,<br>
>>>>><br>
>>>>> Can anyone help me with this? I haven't found a proper solution myself<br>
>>>> yet..<br>
>>>><br>
>>>> Does the following examplary project do what you intend?<br>
>>>><br>
>>>> CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)<br>
>>>> PROJECT(P C)<br>
>>>> SET(CMAKE_VERBOSE_MAKEFILE ON)<br>
>>>> # The library target:<br>
>>>> FILE(WRITE ${CMAKE_BINARY_DIR}/f.c "void f(void){}\n")<br>
>>>> ADD_LIBRARY(f SHARED f.c)<br>
>>>> # The README file:<br>
>>>> FILE(WRITE ${CMAKE_BINARY_DIR}/README "Very important information!\n")<br>
>>>> # The ZIP file command:<br>
>>>> ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/f.zip<br>
>>>> COMMAND zip -j ${CMAKE_BINARY_DIR}/f.zip<br>
>>>> ${CMAKE_BINARY_DIR}/README<br>
>>>> $<TARGET_FILE:f><br>
>>>> DEPENDS ${CMAKE_BINARY_DIR}/README)<br>
>>>> # The ZIP file target:<br>
>>>> ADD_CUSTOM_TARGET(zip ALL DEPENDS ${CMAKE_BINARY_DIR}/f.zip)<br>
>>>> # Trigger ZIP file target after library target:<br>
>>>> ADD_CUSTOM_COMMAND(TARGET f POST_BUILD<br>
>>>> COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/f.zip<br>
>>>> COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}<br>
>>>> --config $<CONFIGURATION><br>
>>>> --target zip)<br>
>>>><br>
>>>> The basic idea is the decomposition of the ZIP file's generation into a<br>
>>>> custom target, an OUTPUT-style custom command and a TARGET-style custom<br>
>>>> command, the latter in conjunction with CMake's --build switch.<br>
>>>><br>
>>>> Regards,<br>
>>>><br>
>>>> Michael<br>
>>>><br>
>>>>> 2011/12/8 Alexander Broekhuis <<a href="mailto:a.broekhuis@gmail.com">a.broekhuis@gmail.com</a>><br>
>>>>><br>
>>>>>> Hi all,<br>
>>>>>><br>
>>>>>> In my project, some top level targets depend on simple text files.<br>
>> These<br>
>>>>>> targets produce a zip file as output, this is done using a custom<br>
>>>> command<br>
>>>>>> with a post-build to a library target.<br>
>>>>>> Part of the zip file are some simple text files, which are included<br>
>>>> using<br>
>>>>>> some custom CPack handling inside the custom command.<br>
>>>>>><br>
>>>>>> How can I let the top level target depend on these text files as well?<br>
>>>> In<br>
>>>>>> other words, if a text files changes, the zip file has to be<br>
>>>> regenerated.<br>
>>>>>> These text files are not generated or copied etc. So a simple DEPENDS<br>
>>>> would<br>
>>>>>> suffice. I know add_custom_command(OUTPUT has support for this, but am<br>
>>>>>> wondering how to do this with add_custom_command(TARGET.<br>
>>>>>><br>
>>>>>> TiA!<br>
>>>>>><br>
>>>>>> --<br>
>>>>>> Met vriendelijke groet,<br>
>>>>>><br>
>>>>>> 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>