Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clion CMakeLists.txt not found when switching PC

Tags:

cmake

clion

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.

like image 417
Christopher Schneider Avatar asked May 14 '15 01:05

Christopher Schneider


People also ask

How do I run CMakeLists TXT in CLion?

To open a project, you can point CLion to the top-level CMakeLists. txt and choose Open as Project. You can edit CMakeLists. txt files right in the Editor.

How do I run CMakeLists txt in Windows?

Running CMake for Windows / Microsoft Visual C++ (MSVC) Run cmake-gui.exe, which should be in your Start menu under Program Files, there may also be a shortcut on your desktop, or if you built from source, it will be in the build directory. A GUI will appear similar to what is shown below.

How do I create a CMakeLists txt file?

In Qt Creator, go to File → Open File or Project… and choose CMakeLists. txt from the source folder you want to build. Qt Creator will prompt you for the location of the binary folder, calling it the “build directory”. By default, it suggests a path adjacent to the source folder.


1 Answers

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.

like image 148
Christopher Schneider Avatar answered Sep 17 '22 15:09

Christopher Schneider