[CMake] Generating Source Files

Bill Hoffman bill.hoffman at kitware.com
Sun Apr 5 11:59:40 EDT 2009


Jeremy Cowgar wrote:

> But, that executes each time that we run make, therefore it works great. 
> I am looking for that ability in CMake but am having a hard time. We 
> currently have 3 make files going, one for Unix systems (gcc, make), 
> another for OpenWatcom and another for MSVC. What is happening (and is 
> hard not to happen) is a change is made, say a new file is added, and 
> the dev who did it works in Windows and updated the Watcom makefile and 
> forgets about the MSVC and Unix makefile because they have neither. Or 
> maybe they do remember, but can't test, they make the change and it was 
> a typo, etc...
> 
I have two ideas:

1.Have the custom command create a whole sub-project in CMake, then use 
ctest --build-and-test to build the sub-project during the custom command.

2. Create a fast version of your parser executable that spits out the .c 
files that will be created, that could be run at cmake time and create a 
file that is included by the include command.  It could do a copy if 
different so cmake would not run every time, but only when the number of 
files changes.

-Bill


More information about the CMake mailing list