[CMake] Generating files during building

Gustavo glab at iol.pt
Thu May 31 09:29:54 EDT 2007


Thank you for taking interest.

On Thursday 31 May 2007 02:02, Brandon Van Every wrote:
> On 5/30/07, Gustavo <glab at iol.pt> wrote:
> > Due to a limitation of the compiler used, I need to split one of the
> > (generated) source files into N pieces of a maximum size. These all have
> > the same filename, ending in a number up to N.
> >
> > Since the sourcefile is generated, the number of files created is
> > unpredictable and unknown until it is processed.
>
> How many of these sourcefiles do you have?  If only a few, you could
> probably do something easier than if there are tons and tons of them.

There is only one sourcefile that is too big. But it is WAY too big. I'd say 
that, depending on the data, can reach a few thousand files.

> > All these N files should be compiled into a .o file each, and linked to
> > the main binary in the end.
>
> Finding .o files is a real PITA.  So, you're going to want to generate
> your .c files, figure out which .c files you actually have, then do
> CMake as usual.

Yes, that is what I want to do. The problem is how to do it!
All the ideas I have require me to run cmake twice: first to generate the 
source files, then to glob for them or find them in some other way.

The alternative is running a script. But then I would be using an inferior 
tool to do half of CMake's job.

-- Gustavo


More information about the CMake mailing list