Running custom Clean

Answered

Hi

I'm calling an existing Makefile for building, so in order to rebuild I'd need to call `make clean` first. I see that `Run | Clean` calls

`cmake --build <dir> --target clean -- -j 4`

Is there a way to make `Run | Clean` run a custom target instead? For instance, one that is defined as:

`add_custom_target(make-clean ALL COMMAND make -C ${mytest_SOURCE_DIR} clean)`.

 

Thanks

0
2 comments

Hi!

You can do this, but it would be intrusive and make-specific. Maybe you can use a separate IDE macro (see the workaround from the corresponding ticket: https://youtrack.jetbrains.com/issue/CPP-8886)? Also feel free to follow or upvote it.

0
Avatar
Permanently deleted user

But can a macro select a custom target? In my case, if I have a macro for rebuilding, I'd need it to call `make clean` and then `make all`. I have these as separate custom targets right now, but how do I setup the macro so that the targets are chosen in the appropriate sequence automatically?

 

Thanks

0

Please sign in to leave a comment.