How to include custom system header locations for code inspection?

Answered

If I wanted to add locations to the list of location that CLion uses to determine whether the header exists, how can I do this?

 

E.g, if I have a file:

`sys/dev/pci/drm/drmP.h`

in my project (where `sys` is an immediate subdirectory of the project root), how can I get CLion to recognise and parse:

`#include <dev/pci/drm/drmP.h>`

 

I've already added:

`include_directories(sys)`

to `CMakeLists.txt`, but this hasn't changed anything.

0
3 comments

Hi!

What do you mean by "recognise and parse"? Is the #include <dev/pci/drm/drmP.h> line red? Have you reloaded your CMake project after adding include_directories?

I tried to emulate your situation and CLion found the header successfully on my side (in CMakeLists.txt I have include_directories(first)):

0
Avatar
Permanently deleted user

Anna,

 

Yep, in my case the include line was highlighting the `dev` component as red, even after reloading the `CMakeLists.txt` file.

 

What you've put together there is not 100% the same as what I'd outlined, the change in the include would be to `#include <second/hedhed.h>`. However, I've reproduced what you put there, with the changed include line, and it doesn't show the include in red, so it seems that `include_directories` is enough.

 

What I'm seeing could be a result of https://youtrack.jetbrains.com/issue/CPP-12787, so once that's looked at it could prove this won't be a problem again.

 

Thanks for the response!

Tom

0

Tom,

Thanks for the info! Strange fact: #include <second/hedhed.h> also works fine on my side. But I'm glad that include with quotes worked for you.

0

Please sign in to leave a comment.