<div class="gmail_quote">On Wed, Sep 15, 2010 at 11:15 AM, Nick Davidson <span dir="ltr"><<a href="mailto:Nick@toby-churchill.com">Nick@toby-churchill.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Whoops, forgot to reply on list, sorry!<br>
<br>
> From: <a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a><br>
> [mailto:<a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a>] On Behalf Of Andreas Pakulat<br>
> Sent: 15 September 2010 13:03<br>
> To: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
> Subject: Re: [CMake] add_dependency on a custom target<br>
<div><div></div><div class="h5">><br>
> On 15.09.10 12:34:43, Nick Davidson wrote:<br>
> > Dear List,<br>
> ><br>
> > I'm using a file glob to extract a list of xml files to pass to a<br>
> > custom target to generate a pot file with getttext, most of<br>
> the heavy<br>
> > lifting is handled by a Macro.<br>
> ><br>
> > include(FindMsgfmt)<br>
> > macro (MakePot BIN_NAME CPP_SOURCES XML_SOURCES)<br>
> > set(CPP_SRCS ${CPP_SOURCES})<br>
> > set(XML_SRCS ${XML_SOURCES})<br>
> > set(POT_FILE ${BIN_NAME}.pot)<br>
> > if (XGETTEXT_FOUND)<br>
> > message(STATUS "Adding Target Potfile: ${POT_FILE}")<br>
> > if (XML_SRCS)<br>
> > add_custom_target(${POT_FILE} ALL<br>
> > COMMAND ${XGETTEXT_EXECUTABLE} --language=C++<br>
> --force-po<br>
> > -kN_ -kNN_:1,2 -o ${POT_FILE} ${CPP_SRCS}<br>
> > COMMAND ${XGETTEXT_EXECUTABLE} --language=Glade<br>
> > --force-po -j -o ${POT_FILE} ${XML_SRCS} )<br>
> > else (XML_SRCS)<br>
> add_custom_target(${POT_FILE} ALL<br>
> > COMMAND ${XGETTEXT_EXECUTABLE} --language=C++<br>
> --force-po<br>
> > -kN_ -kNN_:1,2 -o ${POT_FILE} ${CPP_SRCS})<br>
> > endif(XML_SRCS)<br>
> > add_dependencies(${POT_FILE} ${XML_SOURCES} ${CPP_SRCS})<br>
> > else (XGETTEXT_FOUND)<br>
> > message(STATUS "Cannot find xgettext")<br>
> > endif(XGETTEXT_FOUND)<br>
> > endmacro (MakePot POT_NAME)<br>
> ><br>
> > The only problem is, if the list of xml files changes (e.g. a<br>
> > deletion) the cmake cache doesn't get regenerated and thus the xml<br>
> > files are not reglobbed and so the custom command fails.<br>
> ><br>
> > Any suggestions?<br>
><br>
> Don't use a glob (list the files individually) or remember to touch<br>
> the cmakelists.txt file after adding new files. I don't think there's<br>
> a way to have cmake re-run when calling just make within<br>
> cmakelists.txt.<br>
<br>
</div></div>Ok, but why doesn't adding the files as dependencies work?<br>
The glob is stored in the cache - fine, there isn't a way for Cmake to<br>
automatically figure out what files it should check to see if anything<br>
has changed. Having added those files as dependencies of the target that<br>
uses the glob manually then surely it's just a list of files?<br>
<br>
<br>
Is there a fundamental difference between a list variable made from<br>
a globbed set of files and a list made from a manually specified set?<br></blockquote><div><br>There's no indication that a set of files retrieved by glob has changed when a file is added or removed from a directory. So if the set changes, neither make nor cmake know that anything is out of date... and nothing re-runs.<br>
<br>The mod time of the file containing the list changes when the manually specified list changes. Therefore CMake can be re-run by make.<br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
><br>
> Andreas<br>
><br>
> --<br>
<br>
Nickd<br>
<div class="im"><br>
______________________________________________________________________<br>
This email has been scanned by the MessageLabs Email Security System.<br>
For more information please visit <a href="http://www.messagelabs.com/email" target="_blank">http://www.messagelabs.com/email</a><br>
______________________________________________________________________<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">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>