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

Chaoren Lin aoe at google.com
Tue Aug 2 14:11:44 EDT 2016


> Ninja always uses the location of the build.ninja file as
> the current working directory, so an IDE that sees a relative
> path in an error message can interpret it relative to that.

Our IDE has no knowledge of the build.gradle file let alone where it is
located, it just sees the build output and tries to located the mentioned
files.
Similarly, the :make command in vim will have no knowledge of build.gradle,
and only tries to parse the build errors directly.

Would changing ConvertToNinjaPath to output absolute paths paths work?

On Tue, Aug 2, 2016 at 10:38 AM, Brad King <brad.king at kitware.com> wrote:

> On 08/02/2016 01:08 PM, Brad King wrote:
> >  Ninja: Use full path for all source files
> >  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d867f8a0
>
> I had to revert that because it causes the Qt*Autogen tests to
> fail.  Also it may break builds on Windows.
>
> There are multiple problems:
>
> * ConvertToNinjaPath does more than just relative path conversions.
>   It also converts slashes on Windows.  Furthermore, it deals with
>   CMAKE_NINJA_OUTPUT_PATH_PREFIX, though that won't matter for
>   absolute paths.
>
> * Calls to AddAssumedSourceDependencies and HasCustomCommandOutput
>   later in cmNinjaTargetGenerator::WriteObjectBuildStatement expect
>   to be given paths that come out of ConvertToNinjaPath.
>
> * Ninja does not seem to be able to reconcile a dependency on
>   an absolute path with a build statement providing that path
>   by relative path.  Custom commands that generate source files
>   list their outputs with ConvertToNinjaPath.
>
> Basically everything assumes that all paths written as inputs
> or outputs of Ninja build statements have gone through the
> ConvertToNinjaPath method.  The special case for "RC" in the
> existing code is likely buggy.
>
> Ninja always uses the location of the build.ninja file as
> the current working directory, so an IDE that sees a relative
> path in an error message can interpret it relative to that.
>
> -Brad
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160802/36c305fc/attachment.html>


More information about the cmake-developers mailing list