[CMake] C/C++ dependency scanner

Steven Wilson steven.wesley.wilson at gmail.com
Thu Mar 18 21:10:54 EDT 2010


Hey all,

I have a large project whose source files start as files with an alternate
extension (.bc).   Those files are mostly generic C files that have some C++
like features that are preprocessed into vanilla C files using a custom C
pre-processor.   My project uses an add_custom_command() call to put the
file through the necessary steps to go from .bc to a .c file.    By the time
it becomes a .c file, the C preprocessor(and the custom preprocessor) has
already run and all the header files, etc have been put into the .c file.
  I need a way to generate a list of dependencies (ie header files) for the
original .bc file so that my add_custom_command() call can use those file
names in the DEPEND section so that the .c file gets regenerated correctly
when any of the dependencies change.

I know different techniques for getting this information into CMake once the
list is compiled for any give source file, but I'm not sure how to generate
the list.   Can CMake's C dependency scanner be invoked (using cmake -E
cmake_depends) to create this kind of list.   The .bc files are generic C
(from a preprocessor scanning point of view) so CMake's dependency scanner
should be able to produce this information.    If cmake -E cmake_depends
cannot function for this task, does anyone know of another tool that could
be forced into service for this type of functionality?

Thanks,

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100318/72888706/attachment-0001.htm>


More information about the CMake mailing list