[CMake] Problem with generated source and header files
Jörg Förstner
Joerg.Foerstner at ubidyne.com
Tue Jun 30 07:10:25 EDT 2009
Hi Tyler,
> I don't know if linking multiple shared libraries together
> like that is
> going to work. You might need to compile libxyz.generated as a static
> lib.
You're right. Either I'll have to use a static library for libxyz.generated or I manage to add the generated objects to libxyz (the non-generated one) directly, in one step.
> > The following attempt does not work, because the
> subdirectory "generated" is still empty, when FILE is called:
>
> Right, because file() is run at CMake time but you need to work with
> files generated at make time.
>
> > FILE( GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/generated/*.cpp )
> > ADD_LIBRARY( xyz.generated SHARED ${SRCS} )
> > ADD_DEPENDENCIES( xyz.generated generate_files )
>
> I can't think of a good way to do this (it seems to me you'd have to
> generate the list at make time and then somehow interpolate the list
> into the already-written Makefile -- sounds ugly).
How about generating a CMakeLists.txt file at maketime, containing the file list and somehow calling make or even cmake again?
> Can you change how you use the generator so that the files it writes
> have predictable names?
The output files' names and contents are derived from a MetaModel. New objects in the MetaModel result in new files' names and contents.
Joerg
More information about the CMake
mailing list