ClangComplete icon indicating copy to clipboard operation
ClangComplete copied to clipboard

Fix missing CMake options

Open Eyenseo opened this issue 9 years ago • 8 comments

If the current directory contains a 'compile_commands.json' file the loop is left early.

Eyenseo avatar Jan 12 '16 19:01 Eyenseo

Thats right, there is no need to keep searching if the compile_commands.json file is found.

pfultz2 avatar Jan 12 '16 20:01 pfultz2

Are you sure?

Without this (with the return) the subdirectories are not searched and my project was missing almost all of my include directories

Eyenseo avatar Jan 12 '16 20:01 Eyenseo

Why are your include directories not in the compile_commands.json file? Is cmake emitting an empty compile_commands.json file?

pfultz2 avatar Jan 12 '16 20:01 pfultz2

Well this is interesting...

My project does not make use of CMAKE_EXPORT_COMPILE_COMMANDS but a 3rd-party library does - what happened was, that before introducing this library everything worked fine and "suddenly" I got no completions for my own classes.

I would say this is not so much of a fix but an improvement to support mixed projects - unless there is another disadvantage than the initial runtime cost.

Eyenseo avatar Jan 13 '16 06:01 Eyenseo

Perhaps it would be better to have config that sets where the flags come from.

pfultz2 avatar Mar 11 '16 17:03 pfultz2

That would be the best solution I guess. There would have to be three options:

  • Flags from compile_commands.json (For the 'best' match - currently the fine grained information is not used but that could change.)
  • Flags from flags.make (Legacy option - probably the default?)
  • Mixed (Compatibility for mixed projects like the one I have.)

Eyenseo avatar Mar 11 '16 17:03 Eyenseo

I am thinking like:

  • auto - like how it is now, so it will pick up flags either from flags.cmake or compile_commands.json
  • json - only use flags from the compile_commands.json
  • make - only use flags from flags.make and ignore any flags in compile_commands.json

pfultz2 avatar Mar 11 '16 18:03 pfultz2

That would work too!

I had another a look at the build dir and it seems that the flags.make file gets still created even though CMAKE_EXPORT_COMPILE_COMMANDS is set. I was under the impression that that was not the case as the third party library had no flags.make, but now I realised that it doesn't have any flags in the json file ...

:+1:

Eyenseo avatar Mar 11 '16 19:03 Eyenseo