[CMake] Building from generated code
Christian Hoffmann
christian_hoffmann at gmx.net
Tue Mar 4 13:31:07 EST 2008
Hi out there!
First of all, thanks to Kitware and everyone contributing to CMake: great
work! I am working in a numerical research group and we often have to stick
together all kinds of highly-experimental software packages in various
languages and with the strangest requirements. Guess it's called 'science' ;).
Half a year ago, we migrated all our projects from hand-written makefiles and
scripts (quite non-trivial) to CMake. This _severely_ reduced the effort we
require to get this stuff running together smoothly. Big applause!
However, I am currently stuck and cannot find an answer in the Wiki or the list:
I have two packages P_A and P_B, both built by CMake. To build P_B, the
following steps are required:
1. Build P_A - no problem. Provides me with executable E.
2. In P_B: call E to generate sources
P_B contains a set of sources S and a "configuration file" C,
both provided by the user (Yes, our users are programmers!).
When E is called, it reads C, and, depending on its content, generates
new sources S'.
3. Compile and link sources S and S' to a single library in P_B.
All steps should be performed without minimal user interaction.
Without parsing C by myself ( this is NO option!;) ), I cannot predict WHAT
sources S' will be generated by E. However, it is possible to determine them
from E's std-output, its log file, or using globs/regexps.
Point 2, running E is not the problem. That was quite straight-forward using
ADD_CUSTOM_COMMAND() or ADD_CUSTOM_TARGET().
But how to perform point 3? How to get the list of generated sources back into
CMake to build the lib?
Currently, I have no idea how to do that. To the best of my recollection,
somebody talked of "called cmake from withing cmake" on the list at some time.
However, I cannot find it.
Good hints appreciated!
Chris
--
Dipl. Phys. Christian Hoffmann
University of Heidelberg
Interdisciplinary Center for Scientific Computing (IWR)
Simulation and Optimization Group
Room 414
Im Neuenheimer Feld (INF) 368
69120 Heidelberg
Homezone: +49 6221 32 66 911
Office: +49 6221 54 88 95
More information about the CMake
mailing list