<p dir="ltr">Hi Olaf,</p>
<p dir="ltr">Le 3 févr. 2013 14:03, &quot;Olaf Peter&quot; &lt;<a href="mailto:ope-devel@gmx.de">ope-devel@gmx.de</a>&gt; a écrit :<br>
&gt; ---8&lt;---<br>
&gt; project(coolcoding)<br>
&gt;<br>
&gt; # generate coolcoding&#39;s static lexer<br>
&gt; set(COOLCODING_BAR_HPP ${PROJECT_BINARY_DIR}/include/foo/io/coolcoding/coolcoding_bar.hpp)<br>
&gt;<br>
&gt; add_executable(generate_coolcoding_bar generate_coolcoding_bar.cpp)<br>
&gt;<br>
&gt; add_custom_command(<br>
&gt;    OUTPUT  ${COOLCODING_BAR_HPP}<br>
&gt;    COMMAND generate_coolcoding_bar ${COOLCODING_BAR_HPP}<br>
&gt;    )</p>
<p dir="ltr">You might want to add</p>
<p dir="ltr"> DEPENDS generate_coolcoding_bar</p>
<p dir="ltr">to this command.</p>
<p dir="ltr">&gt; add_custom_target(coolcoding_dfa DEPENDS ${COOLCODING_BAR_HPP})</p>
<p dir="ltr">I&#39;m not sure why you need this.<br>
 <br>
&gt; What is the recommended way the generate header not in the source-build dir self (means where the generate_coolcoding_bar.cpp is placed)?</p>
<p dir="ltr">I do not know if it is the recommended way or not, but usually, my generators take an input argument with the desired outup file path. You can then easily pass that full path from cmake (in the add_custom_command).</p>

<p dir="ltr">Hope it helps</p>