For removing files, you can use ADDITIONAL_MAKE_CLEAN_FILES: >From http://www.vtk.org/Wiki/CMake_FAQ: Running "make clean" does not remove custom command outputs. Why? In CMake 2.2 and higher custom command outputs should be removed by make clean. Make sure you are using at least this version. Prior to CMake 2.2 custom command outputs were not automatically added to the list of files to clean. In CMake 2.0 the developer can specify a list of files to be deleted. This can be done using SET_DIRECTORY_PROPERTIES setting property ADDITIONAL_MAKE_CLEAN_FILES to the list of files.
We however strongly recommend using an "out-of-source" build which never writes any files to the source tree. Using a separate source and build tree greatly reduces the need for "make clean" and "make distclean" targets to clean away files that differ between builds. Unfortunately, there isn't any such thing to handle removing directories..... ________________________________________ Kelly Hickel From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of Bob Torgerson Sent: Friday, July 30, 2010 4:57 PM To: cmake@cmake.org Subject: [CMake] Adding Additional Changes to Cmake's clean target Greetings, I have recently been tasked with converting our old GNU makefiles to CMake for a medium-sized project involving both C and Fortran external components. CMake has made a big difference and helped make this process much more straightforward for each of the researchers who are using different platforms for compiling their code. However, I have had to make a few custom commands / targets to accomplish some of the additional work that must be done in order to build this project and have discovered that CMake does not automatically generate new statements in its "clean" target when I use these custom commands. Since one of the custom commands is as simple as copying a directory's contents to the current source directory, I would like the clean statement to simply remove these files. Does anyone know of a way to modify the CMakeLists.txt file to allow for new changes to be made to the "clean" target? I have not found the answer online or in the "Mastering CMake" book. Any help you can give me, I would appreciate greatly! Thanks in advance, Bob _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake