[CMake] Problem with generated source and header files

Jörg Förstner Joerg.Foerstner at ubidyne.com
Tue Jun 30 05:56:39 EDT 2009


Hi Marcel,

> Is there a fixed, predictable relation between the input 
> file(s) to the
> generator and the output file(s) that are generated; like 
> with Bison or
> Flex?

The output files' names and contents are derived from a MetaModel. New objects in the MetaModel result in new files' names and contents.

> If that's the case you can construct the list of files to be generated
> from the list of input files to the generator.

I can let the generator output a list of the generated files, see example below. But the list is created, after CMake would need it. It seems a kind of a chicken-or-egg problem.

SET( AUTO_CPP_FILES 
  ./generated/mib_<name1>factory.cpp
  ./generated/mib_<name2>factory.cpp
  ./generated/mib_<name3>factory.cpp
 )

(while <name1>..<name3> can be anything, depending on the model and not predictable)

> If the list of input
> files is not known a priori, you might use globbing (assuming 
> it will be
> known once CMake is being run), but avoid that if possible, because it
> hinders CMake's dependency analysis.

In several threads I have read about file globbing, that it would be a bad idea. What's the cause exactly, does CMake have a problem with the dependencies then?

Joerg


More information about the CMake mailing list