I have a project using CMake to generate Makefiles, which then get built with (GNU) make.
In my project, the CMakeLists.txt
defines two targets - but only one of them gets built when make
ing after Makefile
generation (e.g. using the EXCLUDE_FROM_DEFAULT_BUILD
property).
I want to be able to cleanup (using make
) the files used in the building of one of the targets, but not the files used to build the second target.
How can I do that?
I see two additional options:
Using the internal cmake_clean.cmake
scripts generated for for each target - which, unfortunately, are not directly accessible through make
from the root path. For example, if you have a target named foo
, you would write:
cmake -P CMakeFiles/foo.dir/cmake_clean.cmake
Using ninja
instead of make
generators where you could call
ninja -t clean foo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With