ilyachur/cmake4vim

Odd entries in :CMakeSelectTarget and :FZFCMakeSelectTarget

Closed this issue · 6 comments

Describe the bug
In addition to the real targets, I get some other entries that make no sense. When one of those is selected, nothing happens.

To Reproduce
Not sure.

Expected behavior
Only the targets should appear.

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS
  • Editor vim - 8.2

Additional context
I'll look into this at some point, but I'm just opening an issue so I don't forget.

@mark2185 Do you use Unix Makefiles?
I think the issue is somewhere here.
Here I have a logic to parse command line output for cmake --target help command.
I don't have such problems in my environment, maybe it can depend on version of build tools.

Hmmm, I just thought that for CMake 3.14+ we can use cmake-file-api to get all targets and it should be generator independent.

@mark2185 Do you use Unix Makefiles?

Nope, ninja.

I think the issue is somewhere here.
Here I have a logic to parse command line output for cmake --target help command.

It might be because of that, because help is one of the targets I get!

Hmmm, I just thought that for CMake 3.14+ we can use cmake-file-api to get all targets and it should be generator independent.

That would be great! You have more experience with the cmake API, but let me know if I can help somehow or if you would like me to take that task.

I will try to make some experiments, but of older cmake versions we still need to have these parsers for different Generators.

For Ninja, in ninja.vim:5 seems to work. I don't know why that message started appearing.

-    if stridx(a:line, 'ninja: warning:') != -1 || stridx(a:line, '[') == 0
+    if stridx(a:line, 'ninja: warning:') != -1 || stridx(a:line, '[') == 0 || a:line =~# 'All primary targets'

For Ninja, in ninja.vim:5 seems to work. I don't know why that message started appearing.

Do you mean the 'All primary targets ...' message? Maybe it depends on Ninja version.

BTW I tried to use targets from cmake-file-api response, but it doesn't look like a 100% replacement for Generator specific handler, because the reply from cmake-file-api doesn't contain service targets (like clean, all, help and etc.).

This seems to be solved, the All primary targets part is in master.