Hello<br><br> I am using Visual Studio 2010 generator and cmake 2.8.1 <br>The example code you show, does work with Visual Studio 2005 generator and visual studio 2008 generator , but does not work with Visual Studio 2010 generator, i.e<br>
If I touch the ${PROJECT_BINARY_DIR}/generated.txt, the target is not built anew.<br><br>Thanks <br><br><br><br><br><div class="gmail_quote">On Fri, Apr 23, 2010 at 8:59 PM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"><a href="mailto:Aaron_Wright@selinc.com">Aaron_Wright@selinc.com</a> wrote:<br>
</div><div class="im">> This builds ok the first time, but then change the "<a href="http://generated.txt.in" target="_blank">generated.txt.in</a>"<br>
> and run the build twice and the second time you'll see "Using<br>
> generated.txt" again, which I don't want to see. I've tried VS 2008 and<br>
> NMake, using CMake 2.8 and 2.8.1.<br>
<br>
</div>I was able to reproduce this. There is nothing wrong with the project<br>
that CMake generates in VS. The problem seems to be with the windows<br>
filesystem timestamp granularity. The code below changes the touch<br>
into a copy, and the problem goes away.<br>
<br>
The code can actually be simpler, too. 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>
<div class="im"><br>
<br>
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)<br>
PROJECT(quick_test)<br>
<br>
ADD_CUSTOM_COMMAND(<br>
</div> OUTPUT generated.txt<br>
<div class="im"> COMMAND ${CMAKE_COMMAND} -E copy<br>
${PROJECT_SOURCE_DIR}/<a href="http://generated.txt.in" target="_blank">generated.txt.in</a><br>
${PROJECT_BINARY_DIR}/generated.txt<br>
</div> DEPENDS <a href="http://generated.txt.in" target="_blank">generated.txt.in</a><br>
)<br>
<br>
ADD_CUSTOM_COMMAND(<br>
OUTPUT generated_used.stamp<br>
COMMAND ${CMAKE_COMMAND} -E copy<br>
<div class="im"> ${PROJECT_BINARY_DIR}/generated.txt<br>
</div><div class="im"> ${PROJECT_BINARY_DIR}/generated_used.stamp<br>
</div> DEPENDS generated.txt<br>
COMMENT "Using generated.txt"<br>
)<br>
<br>
ADD_CUSTOM_TARGET(${PROJECT_NAME} DEPENDS generated_used.stamp)<br>
<div><div></div><div class="h5">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br>