Or just use "install(FILES" -- it already does the "if not exists, if newer than" checks...<div><br></div><div>Actually, what you have now is a strange combination of checking for the file's existence at "CMake configure" time, but then running a custom command at "make" time -- both of which happen before "make install" 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"><<a href="mailto:eric.noulard@gmail.com">eric.noulard@gmail.com</a>></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 <<a href="mailto:tanner@real-time.com">tanner@real-time.com</a>>:<br>
<div class="im">> I must be missing something simple?<br>
><br>
> During "make install" I only want to install a set of files if the do not<br>
> exist in destination.<br>
><br>
> MACRO (COPY_IF_DOES_NOT_EXIST SOURCE DESTINATION)<br>
> ADD_CUSTOM_COMMAND (<br>
> TARGET COPY<br>
> IF (NOT EXISTS ${DESTINATION})<br>
> COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE}<br>
> ${DESTINATION}<br>
> ENDIF (NOT EXISTS ${DESTINATION})<br>
> )<br>
><br>
> ADD_CUSTOM_TARGET (<br>
> COPY ALL<br>
> COMMENT "Copy file: ${SOURCE} ${DESTINATION}"<br>
> )<br>
><br>
> ENDMACRO (COPY_IF_DOES_NOT_EXIST SOURCE DESTINATION)<br>
><br>
> Works the first time, but if I delete the destination file a make install<br>
> won't install it again.<br>
<br>
</div>With your current macro the file is "installed" at CMake run time and<br>
not during "make install".<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 "install time".<br>
<font color="#888888"><br>
<br>
<br>
<br>
--<br>
Erk<br>
Membre de l'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>