CLion 2018.2 Help

CMake

File | Settings | Build, Execution, Deployment | CMake for Windows and Linux
CLion | Preferences | Build, Execution, Deployment | CMake for macOS


Use this page to configure CMake in your project. The settings described here are project-related; this page is marked with current project icon icon.

ItemDescription
Automatically reload CMake project on editingIf this checkbox is selected, CLion automatically reloads a project while editing a CMake file.

If this checkbox is not selected, after editing a CMake file a banner shows up, where you can choose to reload the current project manually, or enable automatic reload, which leads to selecting this checkbox:

cl reload cmake

However, if external changes take place (for example, version control update), the CMake project reloads anyway.

Profiles

Profiles list In this field, select a CMake profile to be generated. You can edit or delete the existing profile or create a new one.
  • Click the icons general add button to add a profile to the list. By default, profile is named according to the currently selected build type and toolchain.
  • Click the icons general remove svg button to delete the selected profile from the list.
  • Click the icons actions copy svg button to create a copy of the selected profile.
Note, that the list of CMake profiles determines the list of profiles of the Run/Debug Configurations dialog and the list of resolve contexts.
Name This field represents the name of the selected profile.
Build type From this drop down list select the desired build type. The default type is Debug.
Toolchain From this drop down list, select the desired toolchain. This list consists of toolchains you had created in the Toolchains settings dialog. If nothing is selected, the Default toolchain is used.
CMake optionsIn this text field, specify the additional CMake options to be passed to the CMake command. The options should be delimited with spaces.
You can also press Shift+Enter or click multiline to type the required options in the editor window, each option on a new line.
Environment Click the browseButton button to invoke the Custom variables pane and select there the environment variables to be passed to the Generation phase of CMake.
  • Use icons general add, icons general remove svg, icons actions copy and mainToolbarPaste buttons to manage the list of custom variables.
  • Use Show link to see the list of system environment variables and their values.
Generation path

Specify here the location of the generated CMake files. That could be either absolute (e.g. c:\CLion Projects\My Project\CMake Files\cmake-build-debug or relative to the current project root path (e.g cmake-build-debug):

  • In this text field, type a path or click the browse button to select the desired path from the Select Path dialog.
  • Do nothing to use the default location for generated files.

This setting is saved in .idea/workspace.xml and is not supposed to be shared.

Note: If you select a subdirectory of the project root as the generation output, the IDE marks the files of that subdirectory as excluded from the project and considers them as non-project files. Navigation actions like Navigate to file are not applicable to these files.

Build

Description
Build options In this text field, specify the options to be passed to the build tool used by CMake.
Find more information about the available build options in the CMake documentation.

You can also click multiline to type the required options in the editor window.

If nothing is specified, the default settings are used. Note, that default settings depend on the selected environment. For example, if make generator is selected, the default value is -j <number_of_cpu>, while for Microsoft Visual C++ the field is empty.

Last modified: 18 September 2018

See Also