Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to work on multiple projects in CLion?

Tags:

clion

I'm looking for a way to work on multiple projects in parallel in CLion IDE.

For now I can only work on each project in a window at a time, but I'm looking for a solution similar to Eclipse IDE (see below) - being able to see my different projects' directories on a side bar and choosing the one I want, compiling it by itself, etc.

enter image description here

Is there a way to do it?

like image 547
noamgot Avatar asked Apr 06 '16 06:04

noamgot


People also ask

Can you open multiple projects in CLion?

In CLion, you can open several projects simultaneously in different windows. By default, each time you open a project while another one is opened, CLion prompts you to choose whether to open the project in the same window or in a new window.

Where are CLion projects stored?

Project settings are stored in the project directory as a set of XML files under the . idea folder. This folder contains both user-specific settings that shouldn't be placed under version control and project settings that are normally shared among developers working in a team, for example, the code style configuration.

How do you share projects on CLion?

Open the project you want to share. From the main menu, choose Git | GitHub | Share Project on GitHub. If you have already registered your GitHub account in CLion, connection will be established using these credentials. If you have not registered your account in CLion, the Login to GitHub dialog opens.


2 Answers

Yes: CLion doesn't allow you to open multiple projects from the menu because it uses the CMake system, which is script based.

However, CMake is quite capable of encompassing multiple projects, and CLion will correctly parse your CMake file and show all relevant directories in the project explorer.

Example

To do this, just like in Visual Studio, you need a parent "solution" and one or more child "projects".

Here is a simple CMake example in which "my_solution" references two child projects, "my_application" and "my_library". Here, my three folders are arranged:

  • xxx/my_solution/CMakeLists.txt
  • xxx/my_application/CMakeLists.txt
  • xxx/my_library/CMakeLists.txt

And xxx/my_solution/CMakeLists.txt simply reads:

cmake_minimum_required(VERSION 3.7)
project(my_solution)

add_subdirectory("${PROJECT_SOURCE_DIR}/../my_library" "${PROJECT_SOURCE_DIR}/my_library_output")
add_subdirectory("${PROJECT_SOURCE_DIR}/../my_application" "${PROJECT_SOURCE_DIR}/my_application_output")

Note that it is also permitted to put my_application and my_library within the my_solution directory, as in Visual Studio.

like image 157
c z Avatar answered Sep 21 '22 21:09

c z


No. CLion either:

  • opens a new window with the other project you want to work on
  • closes your current project and opens the new one in the current window

as you can see in the documentation. I think this is wanted in their design; probably to maintain CLion fast and reactive...

like image 23
Chris Maes Avatar answered Sep 21 '22 21:09

Chris Maes