[CMake] using a generator with unknown output

Alexander Neundorf a.neundorf-work at gmx.net
Wed Oct 1 18:53:11 EDT 2008


On Thursday 18 September 2008, dirk.bonekaemper at dfs.de wrote:
> Hi y'all,
>
> I'm a rather new cmake user and I've got a hen & egg problem:
>
> My generator takes an inputfile and a directory,  it creates output files
> in
> that directory. Number and names of generated files depend on the
> contents of the inputfile. However, it also generates a file with a known
> name that contains the names of all generated files.
> The generated files must be compiled to a library, which will be linked
> into an executable.

This is really ugly and I don't know of a nice solution.
The thing is, at buildtime you generate source files, and then these source 
files generated by the (generated) buildfiles, but unknown at the time when 
the buildfiles were created by cmake, have to be compiled by these 
buildfiles.


I think you have to find a workaround, like trying to figure out earlier what 
the names of the generated files will be, or at buildtime create an 
additional file which includes all the generated files (if you can find out 
the names then). This would have the advantage that you would at least know 
the name of the one file you have to compile.
(including all source files into one source file and compiling this needs some 
special attention).

Alex


More information about the CMake mailing list