Skip to content

Conversation

Eyenseo
Copy link
Contributor

@Eyenseo Eyenseo commented Jan 12, 2016

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

If the current directory contains a 'compile_commands.json' file the loop is
left early.
@pfultz2
Copy link
Owner

pfultz2 commented Jan 12, 2016

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

@Eyenseo
Copy link
Contributor Author

Eyenseo commented Jan 12, 2016

Are you sure?

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

@pfultz2
Copy link
Owner

pfultz2 commented Jan 12, 2016

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

@Eyenseo
Copy link
Contributor Author

Eyenseo commented Jan 13, 2016

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.

@pfultz2
Copy link
Owner

pfultz2 commented Mar 11, 2016

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

@Eyenseo
Copy link
Contributor Author

Eyenseo commented Mar 11, 2016

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.)

@pfultz2
Copy link
Owner

pfultz2 commented Mar 11, 2016

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

@Eyenseo
Copy link
Contributor Author

Eyenseo commented Mar 11, 2016

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 ...

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants