I was wondering if there's some way to prevent make clean
in cmake from re-building external dependencies. I'm using ExternalProject
to build third party c++ libraries, and they do not have to be rebuilt even if I do make clean
.
On the other hand, I might want to create a new rule, say, make really-clean
, which even clears the dependencies. is there a good way to do this?
Thanks.
I assume you use ADD_CUSTOM_COMMAND, or ADD_LIBRARY or other ADD_* to create the dependency files.
If your
ExternalProject
has it's own directory and you can putCMakeLists.txt
in that directory, you can easy put following in thatCMakeLists.txt
:So those dependency files won't get cleaned.
If not, you may need to avoid to put the external dependencies as the output files. For example, if you use
then you need to change it to: