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

William A. Hoffman billlist at nycap.rr.com
Tue Sep 20 15:49:48 EDT 2005


Is there a way to run sidl so that it will give you the list of output before it actually
produces the output?  Or perhaps you could parse the sidl files at cmake time with
a cmake macro and produce the set of expected output files.

sidl -expectedoutput *.sidl

At cmake time you need to know the list of sources.   Same sort of thing happens with
FTLK.
SET(FL_INPUT_FILES foo.fl bar.fl car.fl)
FLTK_WRAP_UI(MyLib ${FL_INPUT_FILES})
# at this point the variable MyLib_FLTK_UI_SRCS gets filled with the generated file names
MESSAGE(${MyLib_FLTK_UI_SRCS})

So, you could have:

BABLE_WRAP(MyLib foo.sidl bar.sidl car.sidl)
MESSAGE(${MyLib_BABEL_SRCS})

The macro BABLE_WRAP could use EXEC_PROGRAM sidl -expectedoutput foo.sidl bar.sidl car.sidl,
or it could use cmake to parse the files with FILE read and REGEX to guess the names.

-Bill


At 03:26 PM 9/20/2005, Christophe Dupre wrote:

>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
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list