eddyxu/cpp-coveralls — pull request #14 by nharraud (2013-10-21 12:19:32+00:00)
Title: enable the use of a build directory and add access to gcov options

Most build systems enable the use of a build directory. This directory contains object files but not sources.

Here are the problems I encountered when using cpp-coveralls and which I resolve with these commits:

First the building commands (g++, ld ...) are called in the build directory with relative paths. For example with a build directory "build" at the root of the project, g++ will be called this way "g++ ../src/.../main.cpp". The resulting .gcda .gcno files will contain the relative path "../src/.../main.cpp" which cannot be found relatively to the root of the project. As gcov is called there, it cannot find the sources and fails.
I fix this by adding the option --build-root. This option calls gcov in the given directory. Thus the relative paths are valid.

Second old versions of gcov (before 4.7) do not search the .gcda .gcno files in the same folder as the object file. It searches instead those files in the directory where it is invoked. Thus we use the gcov's --object-directory option which gives the directory where the .o files are located when using the cpp-coverall's --build-root option.

I also added the --gcov-options option which enables the user to give specific options to gcov. This way he may use options like --relative-only which generates a lot less gcov files.

You can find a basic project using these new features here: https://github.com/nharraud/testTravis