[CMake] Relative paths in debug info

Michael Wild themiwi at gmail.com
Fri Jul 2 04:49:02 EDT 2010


On 2. Jul, 2010, at 9:46 , Mathias Lafeldt wrote:

> 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


I never used it, but the GCC option -fdebug-prefix-map=old=new might be what you need. But actually, that's the wrong list to ask ;-)

HTH

Michael


More information about the CMake mailing list