[CMake] don't auto-clean generated files?

Alexander Neundorf a.neundorf-work at gmx.net
Mon Sep 7 16:00:40 EDT 2009


On Monday 07 September 2009, Aaron Turner wrote:
> I'm look for a way to tell cmake to not automatically remove certain
> auto-generated files when the 'clean' target is invoked.
>
> Basically I have:
>
>     add_custom_command(OUTPUT tcpbridge_opts.c tcpbridge_opts.h
>         COMMAND ${AUTOGEN} -L tcpedit tcpbridge_opts.def
>         DEPENDS tcpbridge_opts.def
>     )
>
> And of course, other files depend on tcpbridge_opts.[ch]
>
> The problem is that I don't want tcpbridge_opts.[ch] deleted when
> 'make clean' is run.

Why don't you want this file to be deleted ?
Maybe an ADD_CUSTOM_TARGET() would be more suitable ?

Alex


More information about the CMake mailing list