<font size=2 face="sans-serif">Thanks for checking on this Brad.</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">Brad King &lt;brad.king@kitware.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@cmake.org, Michael Wild &lt;themiwi@gmail.com&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">04/23/2010 11:59 AM</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>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Sent by:</font>
<td><font size=1 face="sans-serif">cmake-bounces@cmake.org</font></table>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Aaron_Wright@selinc.com wrote:<br>
&gt; This builds ok the first time, but then change the &quot;generated.txt.in&quot;<br>
&gt; and run the build twice and the second time you'll see &quot;Using<br>
&gt; generated.txt&quot; again, which I don't want to see. I've tried VS
2008 and<br>
&gt; NMake, using CMake 2.8 and 2.8.1.<br>
<br>
I was able to reproduce this. &nbsp;There is nothing wrong with the project<br>
that CMake generates in VS. &nbsp;The problem seems to be with the windows<br>
filesystem timestamp granularity. &nbsp;The code below changes the touch<br>
into a copy, and the problem goes away.<br>
<br>
The code can actually be simpler, too. &nbsp;CMake 2.8 (and 2.6 I think)<br>
automatically handles relative output files with respect to the<br>
build tree.<br>
<br>
-Brad<br>
<br>
<br>
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)<br>
PROJECT(quick_test)<br>
<br>
ADD_CUSTOM_COMMAND(<br>
 &nbsp;OUTPUT generated.txt<br>
 &nbsp;COMMAND ${CMAKE_COMMAND} -E copy<br>
 &nbsp; ${PROJECT_SOURCE_DIR}/generated.txt.in<br>
 &nbsp; ${PROJECT_BINARY_DIR}/generated.txt<br>
 &nbsp;DEPENDS generated.txt.in<br>
 &nbsp;)<br>
<br>
ADD_CUSTOM_COMMAND(<br>
 &nbsp;OUTPUT generated_used.stamp<br>
 &nbsp;COMMAND ${CMAKE_COMMAND} -E copy<br>
 &nbsp; ${PROJECT_BINARY_DIR}/generated.txt<br>
 &nbsp; ${PROJECT_BINARY_DIR}/generated_used.stamp<br>
 &nbsp;DEPENDS generated.txt<br>
 &nbsp;COMMENT &quot;Using generated.txt&quot;<br>
 &nbsp;)<br>
<br>
ADD_CUSTOM_TARGET(${PROJECT_NAME} DEPENDS generated_used.stamp)<br>
_______________________________________________<br>
Powered by </font></tt><a href=www.kitware.com><tt><font size=2>www.kitware.com</font></tt></a><tt><font size=2><br>
<br>
Visit other Kitware open-source projects at </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>
<br>
Please keep messages on-topic and check the CMake FAQ at: </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>
<br>
Follow this link to subscribe/unsubscribe:<br>
</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>
</font></tt>
<br>