ilyachur/cmake4vim

Path is not correctly resolved for out-of-source builds

Closed this issue · 12 comments

My project uses a directory build to do all the cmake specific building. To accommodate for that I did let g:cmake_build_dir = "build" now running CMakeBuild works, but it can't jump to the errors because the path is relativ to the build directory, thus it starts with ../<path-to-file> but vim was started with working directory = project root, so it can't open the file..

Hi @Marenz,

Could you attach the output logs or reproducer?
Cannot you jump to CMake error or build error?

here is the runtime log when doing CMakeBuild: https://gist.github.com/Marenz/3f2ef69bebe3fb1f2b05075e9f2281cd

Cannot you jump to CMake error or build error?

Correct, I cannot jump to the build error. It instead opens a new empty window. Here is a screenshot of the problem: https://imgur.com/5jzNyCd.png

Is there more information I can provide? :)

I use my plugin every day but I didn't face with such issue.
Looks like something wrong with errorformat option, I need to investigate it.
How do you use the plugin?

Do you call CMake and after that use the CMakeBuild command?

I have an already setup build directory (setup with cd build; ccmake .. which I thought I could use. Before that I usually build using ninja -Cbuild from my root directory.

Ok, got it.

Do you still use the ninja as a build system?
Maybe it can be a root cause, I should recheck.
I will try to reproduce your issue using this test application.

PS:
I use Makefiles and I have a plan to add support of other build systems.
Moreover I have to include ninja to CI and cover this functionality by tests if the issue is related with ninja.

@Marenz I have checked.
The issue is related with Ninja build system.

Looks like the issue is not related with plugin, vim cannot parse the Ninja output: https://stackoverflow.com/questions/20600204/quickfix-list-in-vim-when-working-with-ninja-and-clang

I will deeper look to the issue to answer on the question: Can I fix it on the plugin side?.

At the current moment I can jump to error only if set root project directory as a cmake build dir.

@Marenz At the current moment I found the next solution:
You can use g:make_arguments to solve the issue.

So for example:

let g:make_arguments='-C <absolute_path_to_build_directory>'

After that quicklist fix contains correct paths.

Hmm but that only works as long as I have only one project/build dir, right?

Yes, if you have several build directories, you need manually change paths.
Also, I have started to fix this issue in the PR: #27
I cannot merge it now, because some tests were failed.

Also I want to improve the support of Ninja and other build generators.

Hi @Marenz,

Today I have merged PR: #43 where I added a support of Ninja generator. Could you please recheck? I think it should solve all issues with incorrect relative paths.

@Marenz I didn't get a responce from you. I implemented a support of Ninja generator and checked that jump to error works correctly.
I will close the ticket. Feel free to reopen if you have any questions.