Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flycheck-clang-include-path not being set with compile_commands.json #112

Open
abbioro opened this issue May 31, 2017 · 4 comments
Open

Comments

@abbioro
Copy link

abbioro commented May 31, 2017

I generate a compile_commands.json for my project with bear make and one of the arguments is -Isrc to include some source files. Unfortunately cmake-ide fails to set flycheck-clang-include-path properly. I think this might be linked with #111

I took a look at the code and at least cmake-ide--set-flags-for-file has the correct -I argument in hdr-flags, though it is discarded at the end of the function if I'm opening a source file.

@abbioro
Copy link
Author

abbioro commented May 31, 2017

Here's a demo project, make sure to edit .dir-locals.el.

header_fail.zip

@juergenhoetzel
Copy link
Contributor

Had a similar issue. Most likely because bear uses relative file-names but cmake-ide expects absolute paths.

@atilaneves
Copy link
Owner

@juergenhoetzel You're probably right. Since cmake-ide was written with CMake in mind, and I knew CMake only uses absolute paths, it assumes that's the case.

@juergenhoetzel
Copy link
Contributor

@juergenhoetzel You're probably right. Since cmake-ide was written with CMake in mind, and I knew CMake only uses absolute paths, it assumes that's the case.

Seems clangs format specification doesn't enforce absolute paths. Even this example in the official docs uses a relative path: Compilation Database Format.

I came up with this solution for bear (which actually switched from rel. to abs. paths):

jq '[.[] | .file = .directory  + "/" + .file]' compile_commands.json > compile_commands.json.$$ && mv compile_commands.json.$$ compile_commands.json

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

No branches or pull requests

3 participants