Cannot find any cmake profile clion linux

CMake profiles

Settings required for building a CMake project are incorporated into a CMake profile . It includes the toolchain, build type, as well as CMake options such as generators, and environment variables. You can configure multiple profiles for your project in order to, for example, use different compilers or to build targets with differing settings.

To set up the profiles for your project, go to Settings / Preferences | Build, Execution, Deployment | CMake .

You can quickly access this dialog from Find Action ( Ctrl+Shift+A ) (search for CMake Settings ) or assign a shortcut for it in Settings / Preferences | Editor | Keymap .

Add new profiles

Go to Settings / Preferences | Build, Execution, Deployment | CMake .

Click , and CLion will add a new profile to the list.

Change the profile name, build type, and other settings as required.

Build with a profile

Select the desired profile in the Run/Debug configuration switcher:

Build , run , or debug the configuration.

Alternatively, call one of the available Build actions.

Set default profiles for new projects

Go to File | New Projects Setup | Settings for New Projects | Build, Execution, Deployment | CMake .

Configure the list of profiles to be used for all new projects by default.

Disabling/enabling profiles

You can disable the profiles that are not currently in use to save time on loading and avoid potential errors (for example, when you have a remote profile you don’t use regularly and the machine is shut down).

When you enable or disable a profile, CLion incrementally reloads CMake regardless of the Reload CMake project on editing CMakeLists.txt control.

Disable/enable a profile

Use one of the following options:

Clear or set the Enable profile checkbox in Settings / Preferences | Build, Execution, Deployment | CMake . Disabled profiles are grayed out in the list:

To disable a successfully loaded profile, select Disable This Profile from the configuration menu in the CMake tool window:

From this menu, you can also enable any of the previously disabled profiles:

If a profile has failed to load, you can disable it form the CMake tool window using the Disable profile option:

Sharing profiles

You can share CMake profiles in VCS along with the project. The profiles’ settings are stored in cmake.xml in the .idea directory.

To share a profile, select it in the list and set the Share checkbox:

Note that only the Profile settings can be shared. The Reload CMake project on editing CMakeLists.txt option is common for all profiles and is stored in workspace.xml .

Make sure to have different names for shared and local profiles. If a shared and a local profile have the same name, the local one takes precedence and you will not see the shared one in the settings.

Compiler flags

In CLion, there are two ways to specify compiler flags: either in CMake options of a profile, or right in the CMakeLists.txt script.

Set compiler flags

Using CMake options

Select the profile in Settings / Preferences | Build, Execution, Deployment | CMake and edit the CMake options field.

Use -D with the CMAKE_CXX_FLAGS variable (or CMAKE_C_FLAGS for C projects). For example, -DCMAKE_CXX_FLAGS=»-Wall -Wextra» .

Click to insert a project root directory macro, see the CMake settings reference page for details.

Alternatively, add the following line in your CMakeLists.txt script: set(CMAKE_CXX_FLAGS «$ -Wall -Wextra»)

Generators

In the CMake options field, you can specify a CMake generator via -G . For example, in the case of Ninja:

For Ninja Multi-Config, use -G «Ninja Multi-Config» . Note that CLion will use only the configuration that corresponds to the build type of the current profile (see Current limitations ).

Читайте также:  How to make fake windows

You can set up any CMake generator available for your platform and use different generators in different CMake profiles if necessary.

When building your project, make sure to select the desired profile in the configuration switcher:

Note that for a CMake profile, the actual built tools are taken from the selected toolchain. If you specify the generator other than Makefiles, the Make path in the toolchain settings will be ignored.

CLion uses CMake File API, which first appeared in CMake v3.14. However, CLion supports it starting from the update introduced in CMake v3.15, so if you decide to switch from the bundled CMake, make sure to use version 3.15.x or later .

For multi-config generators like Ninja Multi-Config, Xcode, or Visual Studio, CLion uses only the configuration that corresponds to the build type specified in the CMake profile (CPP-20890).

Build types

Use the Build type field to set one of the following CMake build types:

Default (corresponds to the empty value of CMAKE_BUILD_TYPE).

Debug (the default build type)

RelWithDebInfo (Release with debugging information)

MinSizeRel (Release optimized for size)

To refer to the build type in CMakeLists.txt , use the CMAKE_BUILD_TYPE variable. For example:

You can also create conditional statements in your code based on the current build type:

Custom build types

The list of the available build types is defined in the CMAKE_CONFIGURATION_TYPES command. The default value of this command is the four build types given above, but you can extend it to have other build types. For example:

After reloading the project, custom types will be available from the CMake settings:

Note that the custom types were added to the value Debug which was cached in CMakeCache.txt . So for example, if you add a new CMake profile, it will have its own CMakeCache.txt , and for this profile, the list of the available build types will contain your custom types only:

Build options

In the Build options field, you can set the options to be passed either to the build tool used by CMake or as command line parameters to CMake itself. These options will be used during the build phase.

Arguments for the underlying build tool (make, Ninja, or another one) should be preceded with — . For example, if you specify -j 5 —clean-first — -d -p , then -j 5 —clean-first will be processed by CMake, while -d -p will be passed to the build tool.

When nothing is specified in this field, CLion uses default settings which depend on the selected environment. For example, if the make generator is set, the default value of this field is — -j , while for Microsoft Visual C++ this field is empty.

Environment variables

You can pass additional environment variables to CMake generation and build via the Environment field of the CMake Settings dialog (navigate to Settings / Preferences | Build, Execution, Deployment | CMake ).

The overall impacting environment for CMake generation and build consists of:

To include parent environment, open the Environment Variables dialog by clicking or pressing Shift+Enter , and set the Include system environment variables checkbox. The values you specify additionally will be appended to system variables. Otherwise, when the checkbox is cleared, your custom values will overwrite the system ones.

For example, variables defined in vcvarsall.bat for MSVC, path variables like mingw/bin , and others.

CMake profile environment

Your custom variables specified in the Environment field.

For references to existing variables, use the $VAR$ syntax. Mind that such references are case-sensitive, for example, PATH=xxx:$PATH$ for Linux and macOS, and Path=xxx;$Path$ for Windows. Referencing existing variables is currently not available if you are using a remote toolchain (CPP-15693).

Источник

Cannot find any cmake profile clion linux

I haven’t used C / C ++ for many years. VS is too big, my little computer can’t install it. I heard that JetBrains broke the IDE that turned into C / C ++, I went to the clion, the result, the first Hello World Come up, an error is «Toolchains Are Not Configure», can’t touch the mind, it turns out that the compiler is not installed, running to Mingw. This is also intelligent, file-settings-build, execution, DEPLOYMEN, select Toolchains, click +, Search Mingw, you will display no, then poke the blue Download, you will jump to the official website of MINGW. You can do it if you choose your operation.

Читайте также:  Как начать скачивание windows 10

After downloading, you don’t have to do anything. You don’t have to add the environment variable you add the installation path. If you restart the CLion, you will automatically recognize the MingW installation path, Make, C Compiler, C ++ Compiler recognizes Out, you have to do apply Apply and OK. Haha is happy.

Then run, return to the error, the error is «No cmake profile», the online search is the fault of cmake profiles not found, which is different from me, and then discovered that the name of the cmake did not set the right. Set CMAKE, set the build type (Debug / Release), CMake Build option parameters, build directory, and more. Generally, you can keep the default, wait until you need to modify CMake When you build a related option, you will be configured.

Configuration for -dcmake_build_type = debug CMake OptionsSet -> Build, Execute, Deploy -> CMAKE):

CMAKE OPTIONS is set to -dcmake_build_type = debug, Release is not, set is -dcmake_build_type = release

It’s finally good, my Hello World ran up to 2333.

Источник

Установка CLion: компиляторы Cmake не найдены, GDB не найден

я переключаюсь с VS на CLion, и они сказали, что мне нужно установить Cygwin и CMake. Затем я установил оба из них. Я попытался использовать в комплекте, но CLion по-прежнему дает мне эти ошибки make: not found C Compiler: not found C++ Compiler: not found GDB: not found .

Я установил CMake под путь C:UsersGagaDownloadscmake-3.4.1 но я не вижу cmake.exe, самое близкое-cmake.cxx.

без них я не могу ничего скомпилировать, пожалуйста, помогите

3 ответов

в поле» использовать указанное » ставлю C:\cygwin64\bin\cmake.exe ваш путь может быть разным. Просто убедитесь, что CMake, Make, gdb и gcc установлены уже в Cygwin (использование настройки Cygwin.exe не через веб-сайт CMake), но я считаю, что Clion проверяет, установлены ли они после ввода пути.

обходным путем будет использование MinGW. Если вы загрузите его с веб-сайта, он должен поставляться с cmake и заботиться об ошибках.

когда извлеките его и перейдите к установщику, вы должны проверить что-то вроде gcc, а затем из верхнего левого угла что-то вроде «install packages»

убедитесь, что случайно не загрузите источник, который я сделал, что приведет вас к этой ошибке:CLion: CMake Исходный каталог ошибок не существует

Edit: Итак, через год я узнал немного больше о Cygwin и mingw за пределами того, что говорит интернет. CLion нуждается в Unix-подобной среде. Если вы используете CLion на MacOS или Linux, он уже основан на Unix. Все, что совместимо с POSIX, будет работать. CygWin-это эмулятор терминала для windows, где команды Unix, такие как mkdir работа. MinGW-это нечто подобное, но не posix. Поставляется с GCC tho. Я все еще нуб.

У меня была та же проблема. При установке cygwin необходимо выбрать пакеты cmake, gcc, gdb Получил ответ по ссылке ниже.

после установки перейдите на страницу конфигурации и выберите каталог cygwin. CLion определит конфигурацию, и вы закончите.

Источник

Как исправить ошибку «cannot find any CMake profile» при сборке проекта CLion?

Раньше пользовался VS, сегодня установил CLion. Не могу собрать проект. Ругается на CMake profile.

Вот такие ошибки получил:

Как исправить? Заранее благодарен за помощь.

Ответы (4 шт):

Написано прямым текстом, что у вас нет (или нельзя найти) программы make , чтобы собрать сгенерированные Makefile . Установите или укажите явно путь к ней.

Либо генерируйте не их, а что-то другое. Вероятно, проекты visual studio в вашем случае, раз компилятор есть.

Вам вполне ясно сообщается в выводе: CMake was unable to find a build program corresponding to «Unix Makefiles» . Тобишь у вас нет программы, которая могла бы собирать файлы, которые сгенерит cmake . Вангую, что у вас windows а раз так, то никакие не Unix Makefiles а по крайней мере MinGW Makefiles . А вообще для этих целей существуют генераторы — и для Clion я уверен тоже есть. Посмотреть их все можно запустив cmake с флагом -G и выберите нужный.

Читайте также:  Готовый образ виртуальной машины windows

Коллеги, я не понимаю, почему на вполне корректный вопрос такая негативная реакция. я бы хотел ответить более благожелательно и подробно.

1) Ошибка говорит о том, что IDE CLion не может найти утилиту Cmake. Когда Вы устанавливали CLion — там в процессе установки был экран, на котором установщик проверяет наличие разных tools для работы ide. То есть, (в отличие от Visual Studio) среде разработки CLion нужны еще некотрые программы на Вашем компьютере для полноценной работы. И на одном из шагов установки об этом сообщаелось. Это две важные штуки — компилятор и CMake. Если вы испольузете Ubuntu, то устновка того и другого довольно элементарна:

это установка компилятора. Проверка его версии:

Проверка того, что он установился (и версии)

Если Вы используете Windows, то Вам надо посмотреть ресурс https://cmake.org/download/ и оттуда скачать и установить CMale по инструкции. Скорее всего, все будет работать, главное — прописать путь до исполняемых файлов CMake в системном path системы Windows

2) Второй очень важный момент. Когда Вы создаёте проект в CLion — он в проект включает зависимости и скрипты для сборки. Если в момент создания проекта в системе не было CMake, то эти скрипты в проекте — неправильные. И они не исправятся сами по себе после установки CMake. Самый простой способ борьбы с ошибкой в этом случае — после установки CMake заново создать проект.

Понимаю что вопрос старый, но считаю необходимым ответить для следующего кто будет искать.

Ошибка «cannot find any CMake profiles» — это внутренняя ошибка CLion, она говорит о том, что вам необходимо настроить профиль для сборки. Профиль в CLion — это замена аргументам командной строки, которые нужно было бы передать при сборке через консоль. Обратите внимание, что CMake уже входит в поставку CLion, так что вам не нужно устанавливать его отдельно — если только вы не хотите использовать другую версию.

Зайдите в меню File -> Settings. , в нем выберите вкладку Build, Execution, Deployment -> CMake . На этой странице вы можете создать и настроить профиль сборки точно так же, как это делается из командной строки (это хорошо описано в документации самого CMake). По-умолчанию там уже есть один профиль, Debug, но если ваш проект требует дополнительных настроек для сборки (например указания пути к какой-то сторонней библиотеке), то CLion не сможет сгенерировать проект с текущими настройками, и выведет довольно путающую ошибку «cannot find any CMake profiles» (хотя технически профиль есть).

Обратите внимание: хотя меню Settings хранит глобальные настройки, настройки профиля сохраняются отдельно для каждого проекта, т.ч. изменение профилей не помешает сборке других ваших программ.

Что касается следующих ошибок:

Они говорят о том, что у вас не настроен toolchain, т.е. набор компиляторов и утилит для сборки, из-за чего текущий профиль не может быть использован.

Если вы используете Linux, или если вы используете Windows и у вас уже установлена Visual Studio — CLion должен был сам найти подходящий компилятор. Вы можете проверить это, открыв вкладку Toolchains рядом с той, в котороый вы настраивали профили.

Если компилятор действительно не настроен, я советую вам посмотреть вот эти инструкции по настройке: Quick Tutorial: Configure CLion on Windows.
Для Linux воспользуйтесь инструкцией по установки компилятора для вашего дистрибутива. После настройки toolchain вам нужно будет зайти в текущий профиль, и выбрать его в качестве используемого — это исправит ошибки.

Также советую вам ознакомиться с документацией по самому CMake, и с циклом статей на русском языке на Хабре:
Официальная документация CMake (на английском)
Полное руководство по CMake (статья на русском)

Источник

Оцените статью