[CMake] Don't know how to handle this...

Christophe Dupre duprec at scorec.rpi.edu
Tue Sep 20 15:26:05 EDT 2005


There are 3 babel files, each of which needs to be processed. I pretty
much know how to use ADD_CUSTOM_COMMAND to do that.  The problem I have is
that FILE(GLOB) seems to get the files present when I run cmake, that is
before babel ran to generate the files. Does it mean that I will have to
have a CUSTOM_COMMAND that runs cmake itself ? (bummer)


On Mon, 19 Sep 2005, David Cole wrote:

> You can use the CMake expression:
> FILE(GLOB sources "${BABEL_OUT_DIR}/*.cc")
> to collect a list of the *.cc files in the babel output directory after
> babel has run.
>
> Then you can use ${sources} as input to the ADD_LIBRARY command.
>
> The key question is: where does the SIDL file come from? If it's
> static/known in advance, you can make this part of your regular
> CMakeLists processing in the configure step. If it's dynamic/generated
> as part of your build, you'll need to run CMake itself as a custom
> command after the SIDL file exists and after babel has been run to
> generate all the *.cc files.
>
> Does this make sense? Ask more questions if something's unclear...
>
> Hope this helps,
> David
>
>
> Christophe Dupre wrote:
>
> >I'm not sure how to handle a specific case, and I hope that the
> >collective wisdom will provide a few pointers...
> >
> >We have a library for which we use CMake to control the building
> >process. The last step we currently manually do, but which we'd like to
> >automate, is this:
> >
> >We use Babel (http://www.llnl.gov/CASC/components/babel.html) to provide
> >binding for several programming languages. The way babel works is as
> >follows:
> >- an SIDL file describes the API in a language-independant way
> >- the 'babel' program is used to generate .h and .cc files based on the
> >SIDL file.
> >- the .cc are compiled and made into a shared library, which can be
> >called by client programs.
> >
> >The thing here is that the actual name and number of generated .cc files
> >is not known in advance (depends on the SIDL file and the version of
> >babel used). All that we now for sure is that all the .cc files in a
> >given directory need to be compiled and linked together. To help the
> >process, babel generates a babel.make file that defines 'make' variables
> >with all the files - not a big help for CMake, though.
> >
> >This seems to be a case of 'one program generates multiple files'
> >described in the CMake book, except that here the program generates all
> >the files at once with unpredictable names, so the example of VTK doing
> >the TCL wrapping cannot be used as-is.
> >
> >Thanks in advance for any help provided.
> >
> >
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >CMake mailing list
> >CMake at cmake.org
> >http://www.cmake.org/mailman/listinfo/cmake
> >
> >
>
>


--
Christophe Dupre
System Administrator, Scientific Computation Research Center
Rensselaer Polytechnic Institute
Troy, NY        USA
Phone: (518) 276-2578  -  Fax: (518) 276-4886


More information about the CMake mailing list