acostela
acostela

Reputation: 2727

CLion import existing cmake projects with dependencies

I'm testing CLion to check if it will adapt to our needs.I have like 9 different projects in C++ and we generate makefiles using CMake. I read that CLion works well with this kind of projects. I'm trying to create a workspace including these 9 modules in a big project in CLion. The reason is that some of them have dependencies and could be great if we can navigate from one module to other one. I Tried to import them using the option "import project from sources". This detects all my modules but create a huge CMakeLists.txt in the root folder and this is not working for me.

I Would like to have this workspace with these modules and compile them independently but having their dependencies for navigation. I searched a lot but I didn't find anything. Can this be done in CLion?

Thank you

Upvotes: 2

Views: 3882

Answers (1)

Macxx
Macxx

Reputation: 85

To create a root CMakeList.txt, which includes all sub-projects/modules is the way-to-go with CMake. If you want to compile a single submodule you only need to make a single target: make [target].

I think there is a Tool Window in CLion, where you can see all your targets and compile each independently (similar to the Maven Tool-Window in IntelliJ). Alternativly you can create Run Configurations..

(I will append my answer later, to back it with facts.. No CLion at work..)


Unfortunately I was wrong about the Tool Window.. But CLion is creating automatically a Run/Debug Configuration for each target it has found. You can select them by clicking on the Drop-Down Menu in the upper right corner. You can either choose Build All or a specific target. Next to this menu are 3 buttons - Compile, Run and Debug - to trigger any actions.

Upvotes: 1

Related Questions