Working with source files in multiple shared folders

Answered

Hi,

I downloaded a copy of CLion and began trying to evaluate it. But I quickly ran into difficulties because the normal "Add files" menu item I am used to seeing in other IDEs is not available. Since I am used to creating projects which use source files stored "elsewhere" and not in a subfolder of the project folder, this was an immediate grind-to-a-halt moment trying take an existing Eclipse project and try it with CLion.

The Eclipse project itself contains references to source files rather than copies for many of the source files, since they are files shared by other projects. There is usually a common folder somewhere above so the folder references often look like "../../component1/src" or something like that.

Does CLion support this workflow gracefully and if so where would I find some info on using it this way?

Thanks!

0
3 comments

Hello!

Feel free to comment or upvote related issues in our tracker: https://youtrack.jetbrains.com/issue/CPP-14003, https://youtrack.jetbrains.com/issue/CPP-12785. The last one describes workarounds which you can try.

0
Avatar
Permanently deleted user

The posts referenced above do not address the problem. I solved the first order problem by learning more about CMake and manually adding all the source files in other folders. I created variable for the other source folder (which is NOT a subdirectory of the project folder), then referenced all the files off that variable.

That works OK, but trying to create a new source file in a folder somewhere other than the project folder from within CLion seems impossible. This is mind boggling to me and I'm really scratching my head about it. Don't other people create projects in locations other than where many referenced source files live? I do it ALL THE TIME in order to put shared source code in one place, used by many projects. What is the normal CLion workflow for this case? 

 

0

Hi, Andrew.

Whatever you do in CLion, you do that in the context of a project. For now any project in CLion should be encapsulated within the project directory, a root directory of which is referred to as a project root directory and contains all the project files and subdirectories, including configuration, data, source, and other files, related to the given project.

As I've already mentioned, there is a feature request about having an ability to add several content/sources roots: https://youtrack.jetbrains.com/issue/CPP-12785. Possible workarounds are described here.

0

Please sign in to leave a comment.