Steven Wilson wrote:
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?

I have a hack of an idea that might work....

If you could changed your bc -> c generator to put in the #include lines , but with if blockers around it:

#if FOOL_CMAKE_DEPEND_SCANNER
#include "foo.h"
#include "bar.h"
#endif

Since CMake ignores #if directives will depend on foo and bar, but the c compiler will not expand them.

-Bill
_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to