When you make changes in the CMakeLists.txt file, CLion prompts you to reload the project.
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 :
Reload a project
To reload a project manually when needed, use one of the following options:
Call Search Everywhere by pressing ⇧ twice and type
reload cmake. Click the line with the required action:
On the main menu, chooseor
In CMake tool window, click .
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:
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: 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:
Callfrom the main menu:
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.
If you need to unlink your project off the CMake build system completely, use the Unload CMake Project action as described above.