<font size=2 face="sans-serif">I'm trying to do something a little weird,
and I'm almost there but not quite. I'm trying to generate a file and then
run a command based on that file. I only want the command to run when the
file changes and thus the generated file changes. Instead the first build
I get both custom commands run, and then on a second build, the second
custom command runs again, which is not what I want. </font>
<br>
<br><font size=2 face="sans-serif">This is what I got (just an example):</font>
<br>
<br>
<br><font size=2>ADD_CUSTOM_COMMAND(</font>
<br><font size=2>&nbsp; &nbsp;OUTPUT &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;</font>
<br><font size=2>&nbsp; &nbsp;COMMAND ${CMAKE_COMMAND} -E touch &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;</font>
<br><font size=2>&nbsp; &nbsp;DEPENDS &quot;${PROJECT_SOURCE_DIR}/generated.txt&quot;)</font>
<br><font size=2>&nbsp; </font>
<br><font size=2>ADD_CUSTOM_COMMAND(</font>
<br><font size=2>&nbsp; &nbsp;OUTPUT &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;</font>
<br><font size=2>&nbsp; &nbsp;COMMAND ${CMAKE_COMMAND} -E touch &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;</font>
<br><font size=2>&nbsp; &nbsp;DEPENDS &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;</font>
<br><font size=2>&nbsp; &nbsp;COMMENT &quot;Using generated.txt&quot;)</font>
<br>
<br><font size=2>ADD_CUSTOM_TARGET(</font>
<br><font size=2>&nbsp; &nbsp;${PROJECT_NAME}</font>
<br><font size=2>&nbsp; &nbsp;DEPENDS &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;)</font>
<br>
<br>
<br><font size=2 face="sans-serif">What I'm I missing? Thanks</font>
<br><font size=2 face="sans-serif">-------------------------------------------------------------<br>
Aaron Wright</font>
<br>