Creating New CMake Project
To create a new project
- If no project is currently opened in CLion, click New Project on the Welcome screen. Otherwise, select on the main menu.
In the New Project dialog box that opens, you can select a target
type of your project (executable or library) as well as a language to be used: pure C or C++. Note, that
while creating a project, CLion will generate a
CMakeLists.txtfile for you, that includes all the setting provided earlier in the dialog.
As an example, let's create a simple project. Let it be a simple shared library assuming C++ standard 14.
- On the left pane under C++ title, choose C++ library.
- On the right pane, click the Language standard control and select the desired standard from the drop down list, C++14 for our case.
- Go to the Library type control of the right pane and select the desired type. For us that is Shared.
Click Create button to create a project following the settings that you have
provided and generate the respective
- Upon the system prompt, tell CLion where to open your project: in the current or new window.
CMakeLists.txtfile created by CLion contains the options you've provided earlier:
In case you are interested in how to specify header search paths, change compiler used and other settings via CMake, check this quick CMake tutorial.Plugins installed into CLion can provide additional project templates here. For example, a Swift project.