[CMake] Custom-Targets with unknown outputs

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed May 14 10:30:24 EDT 2008


Hi Christoph:

I am going to put this back on the list because others may have better insight
than I do.

On 2008-05-14 07:05+0200 Christoph Cullmann wrote:

> Still, how can I at all include the generated sources into my build? I don't
> want to use the makefiles generated but better convert them to cmake, too.

I have now reviewed your original question, and I think I understand it
better.  At build time you want to generate a large number of source files
with unpredictable names and then use some CMake rule to build a library
using that source.  If you had predicatable names the problem is
straightforward, but with unpredictable ones, I believe doing all that at
build time with CMake is tough/impossible, but I would be happy to be proved
wrong by someone else here.

One alternative I was thinking of was to generate your source at cmake time
with bison/flex using EXECUTE_PROCESS.  The you can collect all the
generated file names into a list variable using file(GLOB ...) or
file(GLOB_RECURSE...) and then use ADD_LIBRARY with that list variable to
create a run-time rule to generate the library.  But I don't recommend that
alternative since the cmake step would run bison/flex every time to generate
(or regenerate) your source, and the dependencies on the files used by
bison/flex would be completely ignored.

Are you sure the generated source file names are completely unpredictable?
Unless some random generator is being used, those names are probably
predictable, and it might be worth your while to look further into figuring
out how you can do that.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list