Tristan Carel wrote:

1.
ADD_DEPENDENCIES(wrapper.cxx foo.hh)
it doesn't work because `foo.hh' is a source file, so not considered
by CMake as a target.

Right.


2.
INCLUDE(AddFileDependencies)
ADD_FILE_DEPENDENCIES(foo.i foo.hh)
It compiles but doesn't work and I don't understand why. It should
generate something like:

My recollection is that ADD_FILE_DEPENDENCIES works only with source files, is slated for removal, and is not recommended for use. If you peruse the list archives, you'll see my posts relating to that.

I've not paid a great deal of attention to the specifics of your problem. I don't have the brain cells for it right now. But what I have generally done to resolve dependency difficulties, is to wrap the ADD_CUSTOM_COMMAND with an ADD_CUSTOM_TARGET. Then I do ADD_DEPENDENCIES on the custom target. The behavior of the latter is far more predictable. I do this whenever I'm getting paranoid about my dependencies being resolved, or whenever I have an actual build bug that needs resolution. Example:

ADD_CUSTOM_COMMAND(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo.c
 [etc.]
)
ADD_CUSTOM_TARGET(foo_c
 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/foo.c
)
ADD_EXECUTABLE(fanny
 [etc.]
)
ADD_DEPENDENCIES(fanny foo_c)


Cheers,
Brandon Van Every


_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to