[CMake] Relative paths in debug info

Mathias Lafeldt misfire at debugon.org
Fri Jul 2 03:46:24 EDT 2010


Hello,

is it possible to tell CMake to write relative source file paths in the
debug information of an object file (aka .mdebug section)?

Here's a sample object file:

$ strings -a build/CMakeFiles/config.dir/src/strbuf.c.o | grep home
/home/foo/bar/src/strbuf.c

Instead of the absolute file path, I'd like to see "src/strbuf.c" or
"strbuf.c".

This is especially interesting when providing binaries that can be
debugged by other people with different file paths.

Maybe it's a special gcc option?

Btw, CMAKE_USE_RELATIVE_PATHS doesn't do it.

-Mathias



More information about the CMake mailing list