[CMake] wanna execute a command on make clean through cmakelists

James Bigler jamesbigler at gmail.com
Wed Apr 8 11:05:03 EDT 2009


On Tue, Apr 7, 2009 at 5:54 AM, ankit jain <ankitguddu at gmail.com> wrote:
> Hi all,
>
> I want to remove certain files when i do make clean.These files are
> generated while running tests.
> how to achieve it..
> if i dont do that the files which once generated remains there...
> on make clean only object files will remove automatically nothing is needed
> to do from our side.
> but apart from that if we want to remove anything while doing make clean how
> to do i dont know..
>
> Guide me with an example..
>
> Ankit

If you know what the files are you can use set_directory_properties
with ADDITIONAL_MAKE_CLEAN_FILES.

       set_directory_properties
              Set a property of the directory.

                set_directory_properties(PROPERTIES prop1 value1 prop2 value2)
              Set  a property for the current directory and subdirectories. If
              the property is not found, CMake will report an error. The prop-
              erties     include:    INCLUDE_DIRECTORIES,    LINK_DIRECTORIES,
              INCLUDE_REGULAR_EXPRESSION, and ADDITIONAL_MAKE_CLEAN_FILES.

              ADDITIONAL_MAKE_CLEAN_FILES is a list  of  files  that  will  be
              cleaned as a part of "make clean" stage.

James


More information about the CMake mailing list