Or just use &quot;install(FILES&quot; -- it already does the &quot;if not exists, if newer than&quot; checks...<div><br></div><div>Actually, what you have now is a strange combination of checking for the file&#39;s existence at &quot;CMake configure&quot; time, but then running a custom command at &quot;make&quot; time -- both of which happen before &quot;make install&quot; entirely.<br>
<br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br><div class="gmail_quote">On Wed, Sep 9, 2009 at 3:20 AM, Eric Noulard <span dir="ltr">&lt;<a href="mailto:eric.noulard@gmail.com">eric.noulard@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2009/9/9 Bob Tanner &lt;<a href="mailto:tanner@real-time.com">tanner@real-time.com</a>&gt;:<br>
<div class="im">&gt; I must be missing something simple?<br>
&gt;<br>
&gt; During &quot;make install&quot; I only want to install a set of files if the do not<br>
&gt; exist in destination.<br>
&gt;<br>
&gt; MACRO (COPY_IF_DOES_NOT_EXIST SOURCE DESTINATION)<br>
&gt;        ADD_CUSTOM_COMMAND (<br>
&gt;                TARGET COPY<br>
&gt;                IF (NOT EXISTS ${DESTINATION})<br>
&gt;                        COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE}<br>
&gt; ${DESTINATION}<br>
&gt;                ENDIF (NOT EXISTS ${DESTINATION})<br>
&gt;        )<br>
&gt;<br>
&gt;        ADD_CUSTOM_TARGET (<br>
&gt;                COPY ALL<br>
&gt;                COMMENT &quot;Copy file: ${SOURCE} ${DESTINATION}&quot;<br>
&gt;        )<br>
&gt;<br>
&gt; ENDMACRO (COPY_IF_DOES_NOT_EXIST SOURCE DESTINATION)<br>
&gt;<br>
&gt; Works the first time, but if I delete the destination file a make install<br>
&gt; won&#39;t install it again.<br>
<br>
</div>With your current macro the file is &quot;installed&quot; at CMake run time and<br>
not during &quot;make install&quot;.<br>
<br>
You may check that fact if you rerun cmake the file is copied again.<br>
<br>
You should look at the install(SCRIPT or install(CODE  command<br>
in order to execute CMake script at &quot;install time&quot;.<br>
<font color="#888888"><br>
<br>
<br>
<br>
--<br>
Erk<br>
Membre de l&#39;April - « promouvoir et défendre le logiciel libre » -<br>
<a href="http://www.april.org" target="_blank">http://www.april.org</a><br>
</font><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></div>