How do I add my libraries to the project?

Since CLion relies on CMake build system, you can do this with CMake commands. To add libraries to your project, use find_package (if you use separate libraries, for example, installed in the system) and target_link_libraries CMake commands. In target_link_libraries, specify either the variable generated by find_packages or library target name (if your library is also built by CMake and has the same parent project, so library target is accessible).

Find more details and samples in our Quick CMake Tutorial.


14 out of 156 found this helpful


Whould be great if you could provide Clion + SDL solution, for beginners,

I checked JetBrains Quick Tutorial but i still can't handle it




P.S. to my previous message, your edit button ain't working.

i'm using linux


Pavlo, since CLion just works with CMake projects, all you need is to have a correct CMake project with SDL included. If it compiles correctly thought CMale, CLion will be able to run CMake on it and get all the necessary information.

This thread on SO has some useful information and links.



Adding external shared libraries to my C++-Projects in Clion under Linux works well. But there are two things I can't figure out. If I have a release and a debug version of an external shared library, for example:


Now I want to link against the debug version in a debug build, and against the regular version otherwise. I cannot find any hints how to do this. Is there a blog post, a form entry, a faq entry how this can be done?


The second question regards an external shared library sources. The library is not part of my project. Let say itcomes precompiled as an rpm from the distro. As it is open source there is also the source rpm. So we have



and now there is


I know how I get CLion to recognize the first two. But how do I tell Clion about the external shared library sources? Note that I don't want to debug into the external shared library. But sometimes I just want to inspect the library sources to check for example what exception I might have to deal with.




Здравствуйте подскажите как решить данный вопрос у меня есть вот такие библиотеки как на скриншоте

Вот путь до них C:\Users\WORK-PC\CLionProjects\untitled\lib

Что и куда мне нужно добавить чтобы они начали работать в проекте только можно подробно пожалуйста и рабочий пример.

Так же есть вот такие файлы как на скриншоте

Путь к ним вот такой C:\Users\WORK-PC\CLionProjects\untitled\bin


Тоже объясните различие между ними и какой вариант более предпочтителен для меня (так как я уже всё перепробовал и ноль не могу сделать так чтобы они работали хотя я точно знаю что они работают), спасибо!


Please sign in to leave a comment.

Have more questions?

Submit a request