Hi everyone!

I am trying to get a code generation tool to behave "the same as" a C
source file with respect to dependencies. By that I mean, suppose you have
a C file "a.c". Because it can #include files, every time the content of
`a.c` changes, its dependencies may have changed also. The dependencies get
rescanned with -MMD. I would like some way to emulate this for my code
generator.

First I tried add_custom_command, which takes a fixed DEPENDS list,
determined at the time the custom command is defined. Concretely, I mean
something like this:

function(add_generated_library)
  figure_out_dependencies(deps ${ARGN})
  add_custom_command(... DEPENDS ${deps})
  ...
endfunction()

But that only captures the dependencies at build-system-generation time.
Every time the custom command runs, the DEPENDS list may need to change,
because the changes may imply new dependencies.

How should I go about doing this?

Thanks,
Ken
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to