[CMake] Why is cmake deleting my files?

J Decker d3ck0r at gmail.com
Fri Aug 5 14:59:21 EDT 2016


I'm using "MinGW Makefiles" as a generator...


When I change a cmakelists.txt file, a bunch of sources I specify to copy
from /.../.c to ${CMAKE_BINARY_DIR}/.../.cpp get deleted in binary by cmake.

There are no rules in the makefiles for those files to depend on anything
other than the original .c file, so I was really confused why they kept
getting regenerated... I started to pay attention and found that cmake,
during configure, if a cmakeLists.txt changes goes through and deletes all
those files.


add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/${BASENAME}${FILEEXT}
                              DEPENDS ${SOURCE}
                              COMMAND ${CMAKE_COMMAND} -E copy_if_different
${SOURCE} ${CMAKE_BINARY_DIR}/${BASENAME}${FILEEXT}
                              )


all outputs get deleted?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160805/3bd24c36/attachment.html>


More information about the CMake mailing list