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

Chaoren Lin aoe at google.com
Wed Aug 3 14:11:45 EDT 2016


> If you know /path/to/build why not just interpret relative paths with
> respect to it as a heuristic?  If the paths exist then use them.

It's... a bit complicated. Our IDE (Android Studio) calls another build
system (Gradle) which in turn calls CMake to trigger the build. So the IDE
itself doesn't see the build path, only the failure output.
Also, in the case of vim, the makeprg is user-supplied, so vim has no idea
that it contains a path.

> Another approach is to use ConvertToNinjaPath for all the build.ninja
> inputs and outputs on build statements but use something other than $in
> for the source file on the compilation rule.  Using an "IN_ABS = ..."
> variable could achieve this.

Thanks, I'll try this.

On Wed, Aug 3, 2016 at 5:56 AM, Brad King <brad.king at kitware.com> wrote:

> On 08/02/2016 04:42 PM, Chaoren Lin wrote:
> > Our IDE uses "cmake --build /path/to/build" to invoke the build,
> > so that we only have to deal with CMake and not the underlying build
> system.
>
> If you know /path/to/build why not just interpret relative paths with
> respect to it as a heuristic?  If the paths exist then use them.
>
> > Maybe I can try to fix ninja to resolve paths before sending them to the
> compiler.
>
> The ninja build tool itself does not have enough information to make
> such a transformation.  CMake does though.  See below.
>
> > Or maybe just add a flag to ConvertToNinjaPath or something.
>
> ConvertToNinjaPath is called from several places that don't all know
> whether the file they are passing is a source file for compilation
> or not.
>
> Another approach is to use ConvertToNinjaPath for all the build.ninja
> inputs and outputs on build statements but use something other than $in
> for the source file on the compilation rule.  Using an "IN_ABS = ..."
> variable could achieve this.
>
> -Brad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160803/3ac1f381/attachment.html>


More information about the cmake-developers mailing list