ClangComplete
ClangComplete copied to clipboard
Fix missing CMake options
If the current directory contains a 'compile_commands.json' file the loop is left early.
Thats right, there is no need to keep searching if the compile_commands.json file is found.
Are you sure?
Without this (with the return) the subdirectories are not searched and my project was missing almost all of my include directories
Why are your include directories not in the compile_commands.json file? Is cmake emitting an empty compile_commands.json file?
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.
Perhaps it would be better to have config that sets where the flags come from.
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.)
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
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: