How to use relative paths when generating code coverage info

When I manually compile code to generate coverage info with g++ --coverage ..., it will generate gcno files using relative paths. If I wanted them to be absolute paths, I would add -fprofile-abs-path. However, when using CMake and adding --coverage to CMAKE_CXX_FLAGS, it always uses absolute paths. I need them to be relative paths. Is there a way to do this?

Using relative paths may be problematic. See the following issue for some background: