[CMake] Problem with generated source and header files

Jörg Förstner Joerg.Foerstner at ubidyne.com
Mon Jun 29 14:24:12 EDT 2009


Hello everybody,

I have a problem with generated source and header files.
The main problem is, that I don't want to note each generated file's name manually in a CMakeLists.txt file, because the output of the file generator changes frequently.

The sequence of the build process shall be:
1. Go to build directory and execute "cmake <source-path>"
2. Execute "make"
3. The generator shall be called (but only if the source and header files are not yet generated).
4. The generator creates source and header files in folder 'generated'.
5. The source and header files in folder 'generated' shall be compiled.
6. The source and header files in folder 'generated' shall be added to library "libxyz.generated.so"
7. The library "libxyz.so" shall be built. "libxyz.so" shall be dependent on "libxyz.generated.so". The library "libxyz.generated.so" shall be linked to "libxyz.so".

The following attempt does not work, because the subdirectory "generated" is still empty, when FILE is called:
  FILE( GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/generated/*.cpp )
  ADD_LIBRARY( xyz.generated SHARED ${SRCS} )
  ADD_DEPENDENCIES( xyz.generated generate_files )

How can I build a library from all sources which are previously generated in a defined folder, while not knowing each file's names in advance?

Best regards,
Joerg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090629/57881cc0/attachment.htm>


More information about the CMake mailing list