The relative path is used whenever the build directory is under the source
directory (e.g., under src/build/), so it could still be out of source.

> FWIW, I haven't encountered any problems with Vim's :make with CMake's
> generated Ninja files in out-of-source builds for in-source or generated
> files (I almost never do in-source builds).

Interesting. It appears that if you do
:set makeprg=ninja\ -C\ /path/to/build | make

then ninja will output this:

> ninja: Entering directory `/path/to/build'

and vim interprets that to be the working directory.

However, if you use these:
:set makeprg=cd\ /path/to/build\ &&\ ninja | make
:set makeprg=cmake\ --build\ /path/to/build | make
then the "Entering directory" line wouldn't appear, and vim won't know what
to do.

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.

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 would love to see this too, but it's much easier to fix the problem in
one place (CMake, or even just Ninja), than to fix that for every compiler.

Maybe I can try to fix ninja to resolve paths before sending them to the
compiler.
Or maybe just add a flag to ConvertToNinjaPath or something.

On Tue, Aug 2, 2016 at 11:33 AM, Ben Boeckel <ben.boec...@kitware.com>
wrote:

> On Tue, Aug 02, 2016 at 11:11:44 -0700, Chaoren Lin via cmake-developers
> wrote:
> > Similarly, the :make command in vim will have no knowledge of
> build.gradle,
> > and only tries to parse the build errors directly.
>
> FWIW, I haven't encountered any problems with Vim's :make with CMake's
> generated Ninja files in out-of-source builds for in-source or generated
> files (I almost never do in-source builds).
>
> --Ben
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to