CLion 2017.2 Help

Creating New CMake Project

To create a new project

  1. If no project is currently opened in CLion, click New Project on the Welcome screen. Otherwise, select File | New Project on the main menu.
  2. 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.txt file for you, that includes all the setting provided earlier in the dialog.

Example

As an example, let's create a simple project. Let it be a simple shared library assuming C++ standard 14.

  1. On the left pane under C++ title, choose C++ library.
  2. On the right pane, click the Language standard control and select the desired standard from the drop down list, C++17 for our case.
  3. Go to the Library type control of the right pane and select the desired type. For us that is Shared.
  4. Click Create button to create a project following the settings that you have provided and generate the respective CMakeLists.txt file.
    cl NewProjectDialog
  5. Upon the system prompt, tell CLion where to open your project: in the current or new window.
  6. CMakeLists.txt file created by CLion contains the options you've provided earlier:
    cl NewProjectCMake

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.
Last modified: 29 November 2017

See Also

Concepts:

External Links: