Hi, As part of a project I work on we use CMake's `ExternalProject()` to build a set of runtime libraries that the project needs via a second build system (Makefile based) that knows how to build the runtime libraries. The code (which is full of hacks... sorry) is at [1].
What I want to do is when the `clean` target is invoked in the CMake generated build system is have the command `make clean` invoked on the project being built by `ExternalProject()`. There was a post about this 10 years ago [1], has anything changed since then? Using `ADDITIONAL_MAKE_CLEAN_FILES` is not really an option because CMake doesn't know what files are generated by the other build system. Even if CMake did know what those files were I don't think it should be removing them itself. It should be using the other build system because that knows best how to do a clean. 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. ``` if (TARGET clean) add_custom_target(CleanKLEERuntimes COMMAND make -f mycustom_makefile clean USES_TERMINAL ) add_dependencies(clean CleanKLEERuntimes) endif() ``` Right now this doesn't work though. * `if (TARGET clean)` is always false * `add_dependencies()` does not work on the `clean` target. [1] https://github.com/klee/klee/blob/28a3d47fa03b9ed98f1bbb4f1b38ecbd44ab1a00/runtime/CMakeLists.txt#L104 [2] https://cmake.org/pipermail/cmake/2006-October/011477.html Thanks, 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