<font size=2 face="sans-serif">Well, Michael is right, it does work right
in Linux. I guess the nature of the question changes slightly then to become,
what I'm I not doing right for Visual Studio 9 2008, but that works in
Linux?</font>
<br>
<br><font size=2 face="sans-serif">-------------------------------------------------------------<br>
Aaron Wright</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">Michael Wild &lt;themiwi@gmail.com&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">Aaron_Wright@selinc.com</font>
<tr>
<td valign=top><font size=1 color=#5f5f5f face="sans-serif">Cc:</font>
<td><font size=1 face="sans-serif">CMake List &lt;cmake@cmake.org&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">04/22/2010 01:29 PM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">Re: [CMake] Why is this custom command
run twice?</font></table>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Works fine for me, sorry to say ;-)<br>
<br>
Michael<br>
<br>
On 22. Apr, 2010, at 17:49 , Aaron_Wright@selinc.com wrote:<br>
<br>
&gt; Interesting. I had a little typo in the first example, here's another
one. <br>
&gt; You only need a file called &quot;generated.txt.in&quot; next to the
CMakeLists.txt <br>
&gt; file.<br>
&gt; <br>
&gt; <br>
&gt; CMAKE_MINIMUM_REQUIRED(VERSION 2.8)<br>
&gt; <br>
&gt; PROJECT(quick_test)<br>
&gt; <br>
&gt; ADD_CUSTOM_COMMAND(<br>
&gt; &nbsp;OUTPUT &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;<br>
&gt; &nbsp;COMMAND ${CMAKE_COMMAND} -E copy <br>
&gt; &nbsp; &nbsp; &quot;${PROJECT_SOURCE_DIR}/generated.txt.in&quot; <br>
&gt; &nbsp; &nbsp; &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;<br>
&gt; &nbsp;DEPENDS &quot;${PROJECT_SOURCE_DIR}/generated.txt.in&quot;)<br>
&gt; <br>
&gt; ADD_CUSTOM_COMMAND(<br>
&gt; &nbsp;OUTPUT &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;<br>
&gt; &nbsp;COMMAND ${CMAKE_COMMAND} -E touch <br>
&gt; &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;<br>
&gt; &nbsp;DEPENDS &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;<br>
&gt; &nbsp;COMMENT &quot;Using generated.txt&quot;)<br>
&gt; <br>
&gt; ADD_CUSTOM_TARGET(<br>
&gt; &nbsp;${PROJECT_NAME}<br>
&gt; &nbsp;DEPENDS &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;)<br>
&gt; <br>
&gt; <br>
&gt; This builds ok the first time, but then change the &quot;generated.txt.in&quot;
and <br>
&gt; run the build twice and the second time you'll see &quot;Using generated.txt&quot;
<br>
&gt; again, which I don't want to see. I've tried VS 2008 and NMake, using
<br>
&gt; CMake 2.8 and 2.8.1.<br>
&gt; -------------------------------------------------------------<br>
&gt; Aaron Wright<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; From:<br>
&gt; Michael Wild &lt;themiwi@gmail.com&gt;<br>
&gt; To:<br>
&gt; Aaron_Wright@selinc.com<br>
&gt; Cc:<br>
&gt; cmake@cmake.org<br>
&gt; Date:<br>
&gt; 04/21/2010 11:41 PM<br>
&gt; Subject:<br>
&gt; Re: [CMake] Why is this custom command run twice?<br>
&gt; Sent by:<br>
&gt; cmake-bounces@cmake.org<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; On 22. Apr, 2010, at 5:12 , Aaron_Wright@selinc.com wrote:<br>
&gt; <br>
&gt;&gt; I'm trying to do something a little weird, and I'm almost there
but not <br>
&gt;&gt; quite. I'm trying to generate a file and then run a command based
on <br>
&gt; that <br>
&gt;&gt; file. I only want the command to run when the file changes and
thus the <br>
&gt;&gt; generated file changes. Instead the first build I get both custom
<br>
&gt; commands <br>
&gt;&gt; run, and then on a second build, the second custom command runs
again, <br>
&gt;&gt; which is not what I want. <br>
&gt;&gt; <br>
&gt;&gt; This is what I got (just an example):<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; ADD_CUSTOM_COMMAND(<br>
&gt;&gt; OUTPUT &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;<br>
&gt;&gt; COMMAND ${CMAKE_COMMAND} -E touch <br>
&gt; &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;<br>
&gt;&gt; DEPENDS &quot;${PROJECT_SOURCE_DIR}/generated.txt&quot;)<br>
&gt;&gt; <br>
&gt;&gt; ADD_CUSTOM_COMMAND(<br>
&gt;&gt; OUTPUT &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;<br>
&gt;&gt; COMMAND ${CMAKE_COMMAND} -E touch <br>
&gt;&gt; &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;<br>
&gt;&gt; DEPENDS &quot;${PROJECT_BINARY_DIR}/generated.txt&quot;<br>
&gt;&gt; COMMENT &quot;Using generated.txt&quot;)<br>
&gt;&gt; <br>
&gt;&gt; ADD_CUSTOM_TARGET(<br>
&gt;&gt; ${PROJECT_NAME}<br>
&gt;&gt; DEPENDS &quot;${PROJECT_BINARY_DIR}/generated_used.stamp&quot;)<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; What I'm I missing? Thanks<br>
&gt; <br>
&gt; Your example works fine for me (using CMake 2.8.1 and Unix Makefiles
<br>
&gt; generator on Mac OS X 10.6.2).<br>
&gt; <br>
&gt; Michael<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; Powered by </font></tt><a href=www.kitware.com><tt><font size=2>www.kitware.com</font></tt></a><tt><font size=2><br>
&gt; <br>
&gt; Visit other Kitware open-source projects at <br>
&gt; </font></tt><a href=http://www.kitware.com/opensource/opensource.html><tt><font size=2>http://www.kitware.com/opensource/opensource.html</font></tt></a><tt><font size=2><br>
&gt; <br>
&gt; Please keep messages on-topic and check the CMake FAQ at: <br>
&gt; </font></tt><a href=http://www.cmake.org/Wiki/CMake_FAQ><tt><font size=2>http://www.cmake.org/Wiki/CMake_FAQ</font></tt></a><tt><font size=2><br>
&gt; <br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; </font></tt><a href=http://www.cmake.org/mailman/listinfo/cmake><tt><font size=2>http://www.cmake.org/mailman/listinfo/cmake</font></tt></a><tt><font size=2><br>
&gt; <br>
<br>
</font></tt>
<br>