makefile always - How to output compilation dependencies from CMake or make?




not target (2)

I found the dependency information generated by cmake2.8 (after running make) living in depend.make and depend.internal files, when I'm using a gcc based toolchain. Using VS does not seem to generate such files (but this doesn't seem to be a problem for you). Also these files are cmake internals, so use them at your own risk.

I have a CMake C++ project that is rapidly growing and often changing. I'm trying to reduce compile times to a minimum.

Often, when I rebuild the project, especially after a header change, I'm surprised at how many compilation units need to be recompiled. I'm trying to identify #includes that can possibly be avoided, for example by using pre-declarations or by not inlining trivial functions in headers.

Is there any way to find out, from CMake itself, from the generated Makefile, or directly from the files themselves, which units depend on which headers?

A list would be nice, a visual graph (graphviz?) even nicer. Google turns up nothing for me. CMake has the --graphviz option, but it operates on targets, not individual compilation units.

Something cross-platform (i.e. using just CMake) is preferred, but I'll settle for Linux-only too.


From the Apache website:

site:site is used generate a site for a single project. Note that links between module sites in a multi module build will not work.