<div class="gmail_quote">On Fri, Jan 15, 2010 at 9:44 AM, Marcel Loose <span dir="ltr"><<a href="mailto:loose@astron.nl">loose@astron.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jack,<br>
<br>
The difference with your and my case is that you have an input file<br>
(the .xsd file) and output files (the .h and .cpp files). In my case I<br>
generate the output file, e.g. myheader.h, from <a href="http://myheader.h.in" target="_blank">myheader.h.in</a>, using<br>
configure_file(). The problem is that I cannot get this to work during<br>
'make', only during 'cmake'.<br>
<br>
Best regards,<br>
Marcel Loose.<br>
<br>
On Fri, 2010-01-15 at 15:04 +0100, Smith Jack (Ext. - UGIS - UniCredit<br>
<div><div></div><div class="h5">Group) wrote:<br>
> I do a similar thing with an XSD file from which I generate c++<br>
wrapper classes for accessing the corresponding XML<br>
><br>
> Note the DEPENDS line !<br>
><br>
> MACRO(XSD FILE NAMESPACE)<br>
> ADD_CUSTOM_COMMAND(<br>
> OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/xml/${FILE}.cpp<br>
> OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/xml/${FILE}.h<br>
> DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/xml/${FILE}.xsd<br>
> COMMAND ${XAPI_CODESYNTH}/bin/xsd<br>
> ARGS cxx-tree --generate-serialization --hxx-suffix .h<br>
--cxx-suffix .cpp --fwd-suffix -fwd.hxx --type-naming java<br>
--function-naming java --namespace-map =${NAMESPACE}<br>
--generate-polymorphic --output-dir ${CMAKE_CURRENT_SOURCE_DIR}/xml<br>
${CMAKE_CURRENT_SOURCE_DIR}/xml/${FILE}.xsd<br>
> COMMENT "generating Codesynthesis Wrappers")<br>
> ENDMACRO(XSD)<br>
><br>
><br>
><br>
> > -----Original Message-----<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 Marcel Loose<br>
> > Sent: Friday, January 15, 2010 2:55 PM<br>
> > To: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
> > Subject: [CMake] How to regenerate source file during make?<br>
> ><br>
> > Hi all,<br>
> ><br>
> > I've been struggling with this for hours now and I can't seem<br>
> > to get a grip on it.<br>
> ><br>
> > I have a header file that must be (re)generated during 'make'<br>
> > when some external data have changed. I can successfully<br>
> > generate this file during 'cmake' using configure_file(), but<br>
> > I haven't been able to figure out how I can trigger the<br>
> > configure_file() during make.<br>
> ><br>
> > Should I define a target for this header file? Or can I<br>
> > specify some kind of file dependency, such that when the<br>
> > header file is missing our out-of-date, it will be (re)generated?<br>
> ><br>
> > I guess it must be some clever combination of<br>
> > add_custom_command() and add_custom_target().<br>
> ><br>
> > Best regards,<br>
> > Marcel Loose.<br></div></div></blockquote><div><br></div><div>This should work already: if you change <a href="http://my_header.h.in">my_header.h.in</a> then cmake should re-run to re-configure your file at 'make' time.</div>
<div><br></div><div>If you have additional dependencies that should trigger a re-configure, you should probably convert it to an add_custom_command such that it happens at build time.</div></div>