<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> OUTPUT "${PROJECT_BINARY_DIR}/generated.txt"</font>
<br><font size=2> COMMAND ${CMAKE_COMMAND} -E touch "${PROJECT_BINARY_DIR}/generated.txt"</font>
<br><font size=2> DEPENDS "${PROJECT_SOURCE_DIR}/generated.txt")</font>
<br><font size=2> </font>
<br><font size=2>ADD_CUSTOM_COMMAND(</font>
<br><font size=2> OUTPUT "${PROJECT_BINARY_DIR}/generated_used.stamp"</font>
<br><font size=2> COMMAND ${CMAKE_COMMAND} -E touch "${PROJECT_BINARY_DIR}/generated_used.stamp"</font>
<br><font size=2> DEPENDS "${PROJECT_BINARY_DIR}/generated.txt"</font>
<br><font size=2> COMMENT "Using generated.txt")</font>
<br>
<br><font size=2>ADD_CUSTOM_TARGET(</font>
<br><font size=2> ${PROJECT_NAME}</font>
<br><font size=2> DEPENDS "${PROJECT_BINARY_DIR}/generated_used.stamp")</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>