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

Aaron Turner synfinatic at gmail.com
Sun Sep 6 23:22:08 EDT 2009


On Sun, Sep 6, 2009 at 8:09 PM, Alan W. Irwin<irwin at beluga.phys.uvic.ca> wrote:
> On 2009-09-06 17:59-0700 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.
>>
>> Suggestions?
>
> From the cmake man page, a directory property that might be useful to you is
> CLEAN_NO_CUSTOM.

That actually does work... although making it global for a directory
is a bit unfortunate.  Too bad this isn't per-file.

Thanks!

-- 
Aaron Turner
http://synfin.net/
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin


More information about the CMake mailing list