[CMake] Re: How to nuke a directory (for 'make clean')?

Philippe Poilbarbe Philippe.Poilbarbe at cls.fr
Tue Mar 13 05:47:52 EST 2007


Matthew Woehlke a écrit :
> (Sorry if this double-posts, gmane appears to have rejected it the 
> first time due to server system load.)
>
> Alexander Neundorf wrote:
>> ...
>> I didn't test, but you could try SET_DIRECTORY_PROPERTIES( 
>> ADDITIONAL_MAKE_CLEAN_FILES ) , but I'm not sure it also works with 
>> directories. You could also create a using 
>> ADD_CUSTOM_TARGET(doxyclean ... ) which calls cmake -E ... to remove 
>> the directory and make this target depend on the "clean" target.
>
> No, it doesn't... I already tried this:
>
> SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES doc/)
>
> ...and it doesn't work. Maybe this should be a bug/RFE?
>
At now, I have done this with a ADD_CUSTOM_TARGET(distclean)
which depends on clean and launches a perl script doing the
job (named with a .pl extension in order to be seen as
a script even on windows).

I did also post a feature request (2937) in order to be able to delete
a directory with a command line option of "cmake -E". It allows
being able to delete a directory in the same portable way,
as done with the script above but without a perl dependency.
It has just been implemented: the mail for a "closed" status has
been sent today :) . The command is "cmake -E remove_directory"
which removes the directory and all its content (files/subdirs).

And maybe the ability of deleting directories from
ADDITIONAL_MAKE_CLEAN_FILES have been
implemented (which would be consistent).

-- 
Philippe Poilbarbe
CLS - Space Oceanography Division


More information about the CMake mailing list