Changing Project Root Directory
When you open a CMake project, CLion considers location of
CMakeLists.txt as the project root directory. Also, when you create a new project in CLion, it always places
CMakeLists.txt file in the project root directory. In some cases, however, project structure is such, that the actual project root is not the directory, where
CMakeLists.txt file resides. E.g. source files are located outside of
CMakeLists.txt directory. In such a case CLion allows to change the project root directory.
Change Project Root command doesn't affect the actual location of the main
CMakeLists.txt file. Once the Change Project Root command has been applied, the Project View displays all the files and subdirectories of the project root directory.
You can access this feature in the following way:
- On the main menu, choose