[CMake] Generating dependencies with gcc -M

Tom Birch tbirch at apple.com
Sun Jun 27 23:24:13 EDT 2010


CMake's dependency scanner uses its own parser to scan for #include directives, and then builds up the dependency tree this way. I know it's possible to rig up an invocation of gcc -M to generate the correct dependencies, and then feed this into the OBJECT_DEPENDS property of source files, but that means that dependency generation would happen when running 'cmake .', not 'make'.

I guess the bigger question here is: why doesn't cmake use gcc -M internally when it's available? It's vastly superior to any homegrown parser, so why not use it?

Tom


More information about the CMake mailing list