CLion 2020.1 Help

Reloading Project

When you make changes in the CMakeLists.txt file, CLion prompts you to reload the project.

cl reload cmake png

There are two options for project reload:

  • Reload changes - in this case, you reload the project once, and all the subsequent changes in CMakeLists.txt will also require reloading.

  • Enable Auto-reload - this option lets CLion silently reload the project on every change in your CMakeLists.txt. This is similar to selecting the Automatically reload CMake project on editing checkbox in Settings / Preferences | Build, Execution, Deployment | CMake:

    enabling auto reload in cmake settings

Reload a project

To reload a project manually when needed, use one of the following options:

  • Call Search Everywhere by pressing Shift twice and type reload cmake. Click the line with the required action:

    cmake reload from search everywhere

  • On the main menu, choose File | Reload CMake Project or Tools | CMake | Reload CMake Project

  • In CMake tool window, click icons.actions.refresh.png.

Besides, a project is reloaded when you reset the CMake cache.

Manage Run/Debug configurations on project reload

When you add or delete targets and reload your project, CLion automatically creates or deletes the corresponding Run/Debug configurations. You can control this behavior in the settings of the configuration templates:

create or delete configurations automatically

    Troubleshooting

    CMakeLists.txt file is not detected

    If you open a project in CLion, but no CMakeLists.txt file is detected (for example, the project does not contain a CMakeLists.txt file or it is located out of the project root folder), you can see that there is no CMake tool window opened. Besides, the CMake related options such as Reload CMake Project, Change Project Root Directory, and other options of the main and context menus are unavailable: the project is not associated with the CMake build system. To associate your project with CMake, click the warning message Select CMakeLists.txt file:

    cl SelectCMake png
    Select the desired CMakeLists.txt in the dialog that opens.

    CLion detected an improper CMakeLists.txt file

    If CLion detects a CMakeLists.txt file, but you want to use another one for your project, then you need to disassociate a project from CMake, and then link the project again with the proper CMakeLists.txt. To do that:

    1. Call Tools | CMake | Unload CMake Project from the main menu:

      the unload cmake option in the main menu

    2. Upon this action, the CLion's state is as described in case #1. Now do one of the following:

      • Click Select CMakeLists.txt file and select the proper CMakeLists.txt file from the dialog.

      • Find the desired CMakeLists.txt file in the Project View and right click it. Select Load CMake Project from the context menu.

    Unload CMake

    If you need to unlink your project off the CMake build system completely, use the Unload CMake Project action as described above.

    Last modified: 15 July 2020