[CMake] Adding a generated file as a dependency to a target

Schuchard, Matthew Matthew.Schuchard at gtri.gatech.edu
Fri Jan 27 12:41:39 EST 2012


Contrary to the CMake FAQ, but consistent with what I have been reading elsewhere, it does not seem possible for me with CMake 2.8.6 to add a generated file as a dependency to a target, even in the same directory.

I have done something similar to the following:

add_custom_command(OUTPUT foo.ext)
add_executable(foo foo2.ext)
add_custom_target(foo_custom DEPENDS foo.ext)
set_source_files_properties(foo.ext PROPERTIES GENERATED TRUE)
add_dependencies(foo foo_custom)

The above will not cause a dependency of foo on foo.ext, and when attempting to run make, throws an error of:
No rule to make target 'CMakeFiles/foo_custom.dir/requires'

Could anyone please shine some light on this?
What I have been reading elsewhere (CMake mailing list, stackoverflow, etc.) is that the majority of the time, attempting something similar to the above does not succeed.
Could this fix be included among 2.8.8 updates?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120127/a3db8387/attachment.htm>


More information about the CMake mailing list