CLion stopped recognising project as a CMake project

已回答

For some reason, CLion stopped recognising a project as a CMake project. The CMake tool window disappeared and no matter how many times I reloaded the project or cleared up .idea files, etc, it did not load correctly.

Copying the entire project directory to another directory and opening that worked though.

I also tried to remove and add the "Debug" profile, to no avail.

4

Hello!

In such cases it usually helps to close the project (File | Close Project), delete the entire .idea directory and reopen the project using "Open" on Welcome Screen (point CLion to the top-level CMakeLists.txt file, then choose "Open as Project").

3

I am seeing this problem quite often since some years. It still occurs on CLion 2023.1.2. It happens when updating the iOS/macOS SDKs while CLion is running. If CLion is closed during the SDK update, the problem does not happen. Deleting the .idea folder is annoying as I am manually editing options in the misc section. Anna Falevskaya

0

Is there any other option instead of removing .idea to force a project to work ? I lost my project settings because of it, now i have to spend an houre to back to the build configuration. I'm very disapointed with this bug.

1

I am running into this issue frequently - especially when switching to other Git branches that have no `CMakeLists.txt` file. 

CLion then no longer shows the CMake tool window. Removing the workspace configuration is not a valid solution as I have custom build and run targets that would be lost. 

I found to fix this I need to manually add a `CMakeWorkspace` component to the `.idea/misc.xml` file.

<project version="4">
  ...
  <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
  ...
</project>   
4

thanks to Martin Weber  

now I can get rid of this anoying behaviour

0

请先登录再写评论。