How to exclude external libraries from indexing

Answered

I have a project which itself is quite small but it uses huge external set of headers and libraries. Libraries are not a problem but headers are.

I add such directories in CMake using include_directories(SYSTEM ...). CLion places them under External Libraries in Project Tree. Unlike normal project directories those don't have option to be marked as library/excluded and I feel like they are indexed as regular project directories. Also seems SYSTEM option makes no difference to regular include_directories.

As a result CLion is using 14G of RAM and keeps "Building symbols" after many hours. Is there any way to speed it up? My project really uses only some of headers files in those directories.

I have Eclipse project for the same source tree and added the same external directories to it. Full indexing finishes in 15-20 minutes and I can jump to declaration in such external headers etc.

1
2 comments

Sorry for the delay! There is a workaround. Please manually add to .idea/misc.xml the following code:

 <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
...
<component name="CidrRootsConfiguration">
<excludeRoots>
<file path="$PROJECT_DIR$/headers" /> <- path to system folders here
</excludeRoots>
</component>
0
Avatar
Permanently deleted user

Sorry, only recently I had chance to check this solution.

Now I marked all external directories as excluded I have "External Libraries" tree empty but still indexing takes too long. I understand that even if directory is excluded some headers in it are still scanned if they are included in my project, right? This on its own is OK I think. But can I somehow check what exactly takes so long? Any logs?

I tested that removing that include_directories() command from my CMakeLists.txt makes index building very quick but autocompletion expectedly doesn't work with classes/functions from those libraries so it's not an option.

0

Please sign in to leave a comment.