[cmake-developers] [PATCH] Use full path for all source files in ninja build.

Brad King brad.king at kitware.com
Tue Aug 2 14:21:23 EDT 2016


On 08/02/2016 02:11 PM, Chaoren Lin wrote:
> Would changing ConvertToNinjaPath to output absolute paths paths work? 

No, that will make all paths absolute.  Ninja's design is pretty clear
in that it prefers canonical relative paths when possible.

Note that the conversion to a relative path by ConvertToNinjaPath is
not unconditional.  In an out-of-source build the paths to the source
files in the source tree will be absolute.

---

Compilers know the absolute path to all the files in a translation unit
since the preprocessor was able to read them.  They could be taught to
produce absolute paths in their error messages to work better for IDEs
regardless of how the build system invokes them.  I've never really
understood why they don't make error messages and debug info hold
absolute paths.  For some reason relative paths in these places are
always blamed on the build system when in fact the compiler could
easily produce them.

-Brad



More information about the cmake-developers mailing list