[Cmake] Generating header files and dependencies

Brad King brad.king at kitware.com
Fri Jun 18 11:08:55 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.

Alot of custom command dependencies were fixed in CMake 1.8.  Please 
make sure you are using version 1.8 or newer.  You can run

   cmake --version

to get the version number.

Thanks,
-Brad


More information about the Cmake mailing list