CLion 2019.2 Help

Change Project Root

When you open a CMake project, CLion treats the location of the top CMakeLists.txt as the project root directory. When you create a new project, CLion also places the CMakeLists.txt file under the root.

However, your project may have a different structure: for example, your main CMakeLists.txt script can be located in some subdirectory (like prj_dir/main). For such cases, use the Tools | CMake | Change Project Root command to explicitly point CLion to the directory that you want to be considered as root.

Note that Change Project Root does not affect the actual location of your files. Also, it does not reload your project automatically, so make sure to reload the project manually after changing the project root.

Last modified: 8 November 2019