Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing default settings for Cmake configuration in CLion

In the settings for CLion, CMake only appears in Build, Execution, Deployment under project specific settings. It does not exist under Default Settings. Is there a way I can specify a universal CMake configuration such that it is available to all projects by default for current and all future projects unless specified otherwise?

For example let's say I want to set the Generation path of all projects to a default location of build. Instead of manually editing the project settings for each project to include that, is there a workaround to set that as the default?

Please try to provide a solution that will only affect a local environment

like image 716
Huynh Avatar asked Apr 07 '17 00:04

Huynh


People also ask

How do I add a configuration in CLion?

In CLion, go to File | Settings | Build, Execution, Deployment | Toolchains and select the Visual Studio toolchain that you want to configure, or create a new one. Point the C Compiler and C++ Compiler fields to clang-cl.exe. CLion will suggest the paths detected automatically.

Where are CLion settings saved?

They are stored in the . xml format together with other project files in the . idea directory. Project settings can include VCS configuration, code style options, the list of language inspections, and so on.

What is CMake configuration?

CMAKE_CONFIGURATION_TYPES. Specifies the available build types (configurations) on multi-config generators (e.g. Visual Studio, Xcode , or Ninja Multi-Config ). Typical values include Debug , Release , RelWithDebInfo and MinSizeRel , but custom build types can also be defined.


1 Answers

Only starting from CLion 2019.3 there is ability to configure CMake defaults.

It will affect all new projects (without .idea config directory).

enter image description here

You can specify default build types/toolchains, CMake options, generation path etc. Also there is pretty nice macro $PROJECT_NAME$.

like image 153
Maxim Banaev Avatar answered Oct 12 '22 02:10

Maxim Banaev