1

I have been looking a method or utility to find dependent files for a large scale C/C++ project.

What I want is, when a file is changed(committed), I want our buildbot to run tests of the classes related to the changed file.

Any help would be greatly appreciated!

2 Answers2

1

Depends on which kind of buildbot you're using. The most common method I know is to use the C++ compilers' -M option to generate dependency makefiles you include to your main makefile. Tools like cmake would do this automatically for you without any efforts.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
0

The compiler option

gcc -MMD

will output a list of dependencies used by the compiler, in a format suitable for use with GNU or Posix Make. Other compilers should have similar options, and it's not difficult to transform that dependency format for use with other make systems using e.g. perl.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720