On 5 December 2016 at 14:05, Brad King <brad.k...@kitware.com> wrote: > On 12/03/2016 06:52 AM, Dan Liew wrote: >> There was a post about this 10 years ago [1], has anything changed since >> then? > > No. From my response back then: > >>> The "clean" target is not a first class target available to >>> CMakeLists.txt code....We do plan to make targets like install >>> and clean first class eventually but it is not yet implemented. > > This never happened. These generator-provided targets have very > different semantics (e.g. per-directory behavior in the Makefile > generator) and that makes it hard to define them in a way that is > visible to client code during configuration. It may be possible but > will require deep design thought.
Thanks for the info. Giving developers control of the `clean` target is something I'd like to see even if it does require quite a bit of thought. CMake has special commands for doing `install` so I'd expect something analogous for managing how `clean is performed`. These would be declared on a per directory basis and if the generator worked a per directory basis then we would have per directory clean targets otherwise there would just be a global clean target. >> I realise the `clean` target won't be available for all generators but >> for those that do, it would be really nice to able to do something >> like this. >> >> add_dependencies(clean CleanKLEERuntimes) > > Just as `ADDITIONAL_MAKE_CLEAN_FILES` is a make-specific solution I > think something like `ADDITIONAL_MAKE_CLEAN_COMMAND` or perhaps > `ADDITIONAL_MAKE_CLEAN_TARGET` could be offered. Such configuration > could be interpreted by the makefile generator while generating the > "make clean" target. I suppose that would do the job. I do use Ninja as a generator a lot too. Would Ninja support it too? Dan. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake