CLion does not parse external headers

Has anyone had an issue with CLion not being able to parse header files not in the project root? 

I believe this problem has something to do with the custom cmake workflow I am using in order to cross-compile for an embedded target.

That being the case, is there any CLion specific way to force parse a set of header files? It seems to not be populated from include_directories.

 

 

4 comments
Comment actions Permalink

Hi Andrew.

Could you please try creating a dummy CMake target and add your header files there. In order to avoid listing the files manually you can use the following snippet:

file(GLOB_RECURSE headers "*.h")
0
Comment actions Permalink

Sure, done. However, the problem remains, where I can successfully compile the project, but the CLion parser fails to work.

file(GLOB_RECURSE headers "${SDKDIR}/*.h")
add_executable(dummy ${headers})
set_target_properties(dummy PROPERTIES LINKER_LANGUAGE CXX)
0
Comment actions Permalink

Well, after doing more research, seems to be a bug in CLion.

 

https://youtrack.jetbrains.com/issue/CPP-3962

 

Just posting this here in case anybody reads this post after me.

0
Comment actions Permalink

Hi, Andrew!

 

The issue you mention is mostly related to problem with particular -DCMAKE_SYSTEM_NAME=Generic CMake options on Windows with MinGW. I'm afraid your case could be different from that. Could you please share some project example representing the problem? Do you observe CMake errors or just red #include <header>?

0

Please sign in to leave a comment.