[CMake] adding dependencies on generated files to source code files

Tony Bridges nabridges at gmail.com
Mon Mar 8 21:28:36 EST 2010


Hi All,


I’m attempting to add dependencies for generated code into my builds.  I
have read the wiki article that J Decker posted to me in my last query

http://www.vtk.org/Wiki/CMake_FAQ#How_can_I_add_a_dependency_to_a_source_file_which_is_generated_in_a_subdirectory.3F


, but unfortunately, it doesn’t answer my current question.  Neither has
creative use of search keys turned up anything helpful.



The problem is : the files that are generated are not dependencies of the
top level target (as discussed in the article), they are dependencies of
another source file because they are generated includes.  If I add the
dependency to the executable, there’s no guarantee that the order will be
correct, from what I see.



i.e.

 message compiler runs in directory A, produces a .txt output containing
string definitions.

 Generated file is included into an RC file in directory B, within the
correct RC context.



The piece I’m missing is how to hook a source file as a top level target,
without having to reimplement the compilation phase as a custom rule.



The makefile equivalent of all this is very simply :

    myResource.rc : externalGeneratedFile.txt



This feels like fairly common usage, so I’m sure I’ve just missed something,
but I’m not sure what.


many thanks

/t
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100308/eed7ab35/attachment.htm>


More information about the CMake mailing list