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.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.- 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
CMakeLists.txt
file. - Upon the system prompt, tell CLion where to open your project: in the current or new window.
-
And at last, let's see the
CMakeLists.txt
file that CLion had prepared for you:
See Also
Last modified: 29 March 2017