Search code examples
clion

CMakeCache.txt is found in the project dir, only in-source generation will be performed


I get the following error message in CLion IDE.

Cannot generate 'Release' into /home/jdoe/project/cmake-build-release
CMakeCache.txt is found in the project dir, only in-source generation will be performed.

Nothing in Google helps me using the following keywords:

What is the best way to resume being able to make CLion start using CMakeFiles.txt again (without doing the painful but obvious way of recreating a new project)?

Side note: Any tip on how to improve search of this error message is also welcome.

[Update 1] There is a "non-answer" in StackOverflow.


Solution

  • This is the only reliable workaround to that thorny CLion cmake problem.

    Workaround

    The brutal workaround is to perform:

    1. Delete all cmake-build-*
    2. Delete CMakeCache.txt
    3. From CLion IDE, unload CMake by going to Tools menu item, CMake submenu item, and clicking on Unload CMake project.
    4. Then head over to a different panel, the Project left navigation panel, right-click on CMakeFiles.txt to bring up context menu. Select 'Load CMake project`.

    Also tracking this specific bug at JetBrain (maker of CLion) YouTrack bug tracking website.