CLion 2023.1 Help

Control source, library, and exclude directories

To manage files and directories of your project, use the right-click menu in the Project tool window (to focus on it, press Alt+1).

Exclude from indexing

CLion indexes your project files to enable such features as search, navigation, code completion, code generation, and refactorings. However, your project may contain files for which you don't need these features, for example, logs, binaries, or imported libraries.

In such cases, to reduce the indexing time, you can mark files as plain text and directories as excluded or libraries.

Exclude a file from indexing

If you don't need specific files, but you don't want to completely remove them, you can temporarily exclude these files from the project. Excluded files are ignored by code completion, navigation, and inspections.

To exclude a file, you need to mark it as a plain text file. You can always return excluded files to their original state.

  1. Right-click the necessary file in the Project tool window.

  2. Select Override File Type | Plain text.

    Plain text files are marked with the Plain text icon.

To revert the changes, right-click the file and select Mark as <file type> from the menu.

    Exclude a directory from indexing

    If you don't want CLion to index a certain directory of your project, do the following:

    • In the Project tool window, right-click the directory you want to exclude and select Mark Directory as | Excluded:

      Mark directory as excluded

    Code generation, code completion, and refactorings won't be available for this directory. The files won't appear in search results unless you select this directory explicitly in the Find in Files dialog Control+Shift+F. The directory is marked as excluded the Excluded directory icon.

    To include the directory back again, right-click it and select Mark Directory as | Cancel Exclusion.

    Exclude a library from indexing

    • In the Project tool window, right-click the directory with the library files, and select Mark Directory as | Library Files:

      Mark as library files

    Code generation, code completion and refactorings won't be available for this directory. However, you can make these files available in search results:

    • In Find in Files dialog Control+Shift+F: narrow down your search by selecting the Project and Frameworks scope.

    • When searching everywhere (press twice): check Include non-project items or select Project and Frameworks from the list in the top right corner of the window.

    To unmark the directory, right-click it and select Mark Directory as | Unmark.

    External files

    If your project uses some files outside of the project root, you will see them grouped under the External Sources node in the Project tree:

    External sources in the Project tree

    This helps avoid top-level crowding, for example when generating project files required for code assistance and compilation.

    For CMake projects, CLion also shows a popup suggesting that you change the project root directory. Ignore this message if there is no need to change the project root.

    External sources message
    Last modified: 11 January 2023