CMake -> Eclipse CDT4: how to prevent Eclipse from indexing files not in project?

I’m not sure if this is just a shortcoming of Eclipse or not.

I have a large source tree and also a CMake project that uses a small fraction of the source files in that tree. When I generate for Eclipse CDT4 and import the project, the Eclipse indexer is clearly indexing files that aren’t referenced in the CMake project. Is there a way to control this with CMake? I would have expected Eclipse to only index the specific project files. There is an Eclipse workspace setting:
Properties->c/c++ general->Indexer->“Index source files not included in the build” which I have disabled, but it still indexes sources not included in the CMake project.

Any help appreciated.

I wanted to clarify one thing from my post: the CMake project enumerates all source files explicitly - it does not add sources by file globbing or recursive file globbing. To me this should result in an Eclipse project that is limited to the source files mentioned, but the indexer still tries to index every cpp from the top-level folder on down recursively.

AFAIK, you cannot prevent Eclipse from indexing files that are in the source tree but not referenced in the CMake project.

See the following threads for more details:

1 Like

Thanks - those links are very helpful.

1 Like