<div class="gmail_quote">On Wed, Sep 15, 2010 at 11:15 AM, Nick Davidson <span dir="ltr">&lt;<a href="mailto:Nick@toby-churchill.com">Nick@toby-churchill.com</a>&gt;</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>
&gt; From: <a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a><br>
&gt; [mailto:<a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a>] On Behalf Of Andreas Pakulat<br>
&gt; Sent: 15 September 2010 13:03<br>
&gt; To: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
&gt; Subject: Re: [CMake] add_dependency on a custom target<br>
<div><div></div><div class="h5">&gt;<br>
&gt; On 15.09.10 12:34:43, Nick Davidson wrote:<br>
&gt; &gt; Dear List,<br>
&gt; &gt;<br>
&gt; &gt; I&#39;m using a file glob to extract a list of xml files to pass to a<br>
&gt; &gt; custom target to generate a pot file with getttext, most of<br>
&gt; the heavy<br>
&gt; &gt; lifting is handled by a Macro.<br>
&gt; &gt;<br>
&gt; &gt; include(FindMsgfmt)<br>
&gt; &gt; macro (MakePot BIN_NAME CPP_SOURCES XML_SOURCES)<br>
&gt; &gt;      set(CPP_SRCS ${CPP_SOURCES})<br>
&gt; &gt;      set(XML_SRCS ${XML_SOURCES})<br>
&gt; &gt;      set(POT_FILE ${BIN_NAME}.pot)<br>
&gt; &gt;      if (XGETTEXT_FOUND)<br>
&gt; &gt;          message(STATUS &quot;Adding Target Potfile: ${POT_FILE}&quot;)<br>
&gt; &gt;          if (XML_SRCS)<br>
&gt; &gt;              add_custom_target(${POT_FILE} ALL<br>
&gt; &gt;              COMMAND ${XGETTEXT_EXECUTABLE} --language=C++<br>
&gt; --force-po<br>
&gt; &gt; -kN_ -kNN_:1,2 -o  ${POT_FILE} ${CPP_SRCS}<br>
&gt; &gt;              COMMAND ${XGETTEXT_EXECUTABLE} --language=Glade<br>
&gt; &gt; --force-po -j -o  ${POT_FILE} ${XML_SRCS} )<br>
&gt; &gt;          else (XML_SRCS)<br>
&gt; add_custom_target(${POT_FILE} ALL<br>
&gt; &gt;              COMMAND ${XGETTEXT_EXECUTABLE} --language=C++<br>
&gt; --force-po<br>
&gt; &gt; -kN_ -kNN_:1,2 -o  ${POT_FILE} ${CPP_SRCS})<br>
&gt; &gt;          endif(XML_SRCS)<br>
&gt; &gt;          add_dependencies(${POT_FILE} ${XML_SOURCES} ${CPP_SRCS})<br>
&gt; &gt;      else (XGETTEXT_FOUND)<br>
&gt; &gt;          message(STATUS &quot;Cannot find xgettext&quot;)<br>
&gt; &gt;      endif(XGETTEXT_FOUND)<br>
&gt; &gt; endmacro (MakePot POT_NAME)<br>
&gt; &gt;<br>
&gt; &gt; The only problem is, if the list of xml files changes (e.g. a<br>
&gt; &gt; deletion) the cmake cache doesn&#39;t get regenerated and thus the xml<br>
&gt; &gt; files are not reglobbed and so the custom command fails.<br>
&gt; &gt;<br>
&gt; &gt; Any suggestions?<br>
&gt;<br>
&gt; Don&#39;t use a glob (list the files individually) or remember to touch<br>
&gt; the cmakelists.txt file after adding new files. I don&#39;t think there&#39;s<br>
&gt; a way to have cmake re-run when calling just make within<br>
&gt; cmakelists.txt.<br>
<br>
</div></div>Ok, but why doesn&#39;t adding the files as dependencies work?<br>
The glob is stored in the cache - fine, there isn&#39;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&#39;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&#39;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>
&gt;<br>
&gt; Andreas<br>
&gt;<br>
&gt; --<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>