CLion stopped recognising project as a CMake project

Answered

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.

6
16 comments

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").

6

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>   
6

thanks to Martin Weber  

now I can get rid of this anoying behaviour

1

This still happens with https://github.com/bitcoin/bitcoin on basically every branch change. Martin's fix only works when `misc.xml` is actually present (not always the case) - otherwise I need to do a `git clean -fxd` after closing CLion.

1

This still happens all the time - is there a workaround at least to keep the CMake tool window around when the project isn't recognized?

3

Can confirm Lorinc's comment. This still happens from time to time and is extremely frustrating.

1

Same problem just happen to me! I am on a pressure to make some fix and suddenly CLion ha lost all preset and does not seems to recognize the setup anymore, completely out of the blue!

1

Still happening in 2025.3. Had to reset all of my cmake profiles after switching between projects.

1

Still occurs in 2026.1. Fortunately, Martin's workaround is still effective - but this issue is now 5 years old!

1

This is absurd, can we add a setting to the IDE for this? It is the most annoying behavior ever

1

Same problem 2 weeks ago, solved (again) and today: cmake project lost (again and again and again….) 

0

Hi all!

We understand how disruptive and frustrating this behavior is, and we are sorry you experience it.

To investigate the issue, we need to reproduce it. 

I tried switching branches in the bitcoin project in CLion 2026.1.3, as mentioned in this comment, but couldn't reproduce the issue, unfortunately. Even if I switch to the 28.x branch, in which it's an Autotools project (not a CMake one), I just get the “CMakeLists.txt not found in ~/CLionProjects/bitcoin” error in the CMake tool window:

Could you please inform us if you know the steps to reproduce the issue more or less stably? 

0

Thanks for circling back here. For the past few releases this has been working quite reliably for me, I'm usually not getting the previous errors anymore.

0

Please sign in to leave a comment.