[CMake] How to associate a command with a auto-generated target?

Alexander Neundorf a.neundorf-work at gmx.net
Mon Nov 10 16:13:53 EST 2008


On Monday 10 November 2008, Óscar Fuentes wrote:
> Hello, Alex.
>
> Alexander Neundorf <a.neundorf-work at gmx.net>
>
> writes:
> >> I wish to execute a command when the `clean' target is invoked. That is,
> >> my command shall execute on addition of the normal target action.
> >
> > Doesn't work, you have to do it the other way round: create a custom
> > target my-special-clean, do what you need, and also execute something
> > like ${CMAKE_MAKE_COMMAND} <directories etc> clean
>
> Sadly, this is not acceptable. 

Setting the ADDITIONAL_CLEAN_FILES directory property is not powerful enough 
for you ?
Hmm. Then name it something like "veryclean", "distclean" (oops) or somewhere 
I have also seen "mrproper". I hope they will accept it.
What exactly do you have to clean ? Maybe an additional dependency on 
something would make the cleaning unnecessary ?

> People complain about having to learn
> cmake and I want to avoid giving them a reason for complaining about
> having to learn project-specific ways of doing standard things.
>
> BTW, CMAKE_MAKE_COMMAND is not listed on --help-variables. You mean
> CMAKE_BUILD_TOOL, don't you?

Both exist, I guess CMAKE_BUILD_TOOL is the recommended one.

Alex


More information about the CMake mailing list