[Cmake] Generating header files and dependencies

Brad King brad.king at kitware.com
Fri Jun 18 15:12:53 EDT 2004


Bradley Lowekamp wrote:
>     I am needed to use a script to generate some source and header files 
> in my project. I was able to get the generation of the source code to 
> work well and all of the dependencies to be correct with the  
> SET_SOURCE_FILES_PROPERTIES and the GENERATED option.
>     However with generated header files I can not seem to get the 
> dependencies to work correctly. The  SET_SOURCE_FILES_PROPERTIES with 
> the GENERATED option appears to have no affect. When CMake tries to make 
> the dependencies for the source files, the header files do not exist and 
> so they are not implicitly added as dependent for anything, so they will 
> not get generated. I had to resort to adding them as a dependency  to 
> all source files, which results in an unacceptable amount of building 
> needing to be done when any generated header file is modified, but it 
> does work. (I have what I am doing at the end of this e-mail.) So how 
> can I get the dependencies to work correctly for the header files?
>     I just had a thought as I was righting up this e-mail. If I could 
> add a dependency to the make_depends or what ever target it is, I could 
> some how make the make depends target dependent on the generated header 
> files or something? Any suggestions about how to get this to work would 
> be good and very much appreciated I am actually not sure what versions 
> of CMake I have tried these things with.

I do not think there is currently any better way to get this to work 
than what you are doing now with OBJECT_DEPENDS.  This may be a 
challenging problem.  Somehow we need to convince the build system to 
regenerate dependencies each time the header file is generated.  Clearly 
this will require some modification to CMake.

Please submit a bug report here:

http://www.cmake.org/Bug

Thanks,
-Brad


More information about the Cmake mailing list