5
votes

I'm having issues with Clion (1.0.1) and CMakeLists.txt.

I use GitHub for my projects, and I commit them from directly within the IDE. If I then checkout the project on a different computer, the IDE looks for CMakeLists.txt in the original PC's directory.

The specific error message reported by Clion is this:

Error: CmakeLists.txt not found in C:\Users\Chris\ClionProjects\SDLTestClion

However, this is a Linux machine, so there's obviously no C drive.

Here's what I've tried:

  • File > Invalidate Caches/Restart
  • Change Project Root (from the CMake Window; the obvious solution)
  • File > Settings > Build, Execution, Deployment > CMake
    • There are no settings or variables here that indicate the directory above.

I can't find anything else, so either I'm missing something or this is bugged in version 1.0.1 and I need to sift through project files to change the path that Clion looks for the CMakeLists.txt file.

1

1 Answers

6
votes

Well, I found the issue. As far as I can tell, in version 1.0.1 there is no way to remedy the problem through the IDE.

Solution:

  • Go to projectDir/.idea
  • Open misc.xml
  • Edit the field PROJECT_DIR to point to the directory with the project's CMakeLists.txt.

I think this is a bug and this field should probably be updated when choosing a new project root. A temporary solution may be to add misc.xml to .gitignore but I haven't tested this and don't know if this will cause other problems or if the IDE will automatically regenerate the file.