Search code examples
clion

Marking a directory as a source root in CLion


In PyCharm, we can mark a directory as a source root. How can I do the same in CLion? I'm trying to get CLion to recognize my python import statements.


Solution

  • It turns out that for some reason the "Mark Directory as" option will only present itself in CLion if a CMakeLists.txt file exists. By adding a barebones cmake file, the "Mark Directory as" option became available, and I was able to use that interface to mark directories as a source root. See here for details.