[CMake] How to regenerate source file during make?

Marcel Loose loose at astron.nl
Fri Jan 15 08:55:16 EST 2010


Hi all,

I've been struggling with this for hours now and I can't seem to get a
grip on it.

I have a header file that must be (re)generated during 'make' when some
external data have changed. I can successfully generate this file during
'cmake' using configure_file(), but I haven't been able to figure out
how I can trigger the configure_file() during make. 

Should I define a target for this header file? Or can I specify some
kind of file dependency, such that when the header file is missing our
out-of-date, it will be (re)generated? 

I guess it must be some clever combination of add_custom_command() and
add_custom_target(). 

Best regards,
Marcel Loose.




More information about the CMake mailing list