What is the proper way to make CLion recognize all header files for a project?
I have a project which targets linux and uses GTK3 as a dependency. The issue is that in order to build this, for example, it needs:
gcc -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -pthread -I/usr/include/webp -DWITH_GZFILEOP -I/usr/include/libpng16 -I/usr/include/libxml2 -I/usr/include/pixman-1 -I/usr/include/cloudproviders -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/fribidi -I/usr/include/gio-unix-2.0 -lgtk-3 -lgd
k-3 -lz -lharfbuzz -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo -lcairo-gobject -lgdk_pixbuf-2.0 -lgio-2.0 -lglib-2.0 -lgobject-2.0 -Wall -Werror ./main.c -o ./main
But this can be abbreviated simply to gcc $(pkg-config --cflags --libs gtk+-3.0) -Wall -Werror ./main.c -o ./main
Both of those commands work on the terminal to manually build. However, how can I add all of those include paths to CLion? I think there is a way to add those compiler flags to CMakeLists.txt in CLion, but unless CLion specifically recognizes the include directories, then it won't support the IDE features such as displaying definitions, autocorrect, etc… Is there a way to include all of these dependencies as shown above in a way that CLion will recognize them?
I find it a bit strange that on the left navigation panel, CLion has this:

What is the point in showing “External Libraries”, “Header Search Paths” etc, if when I right-click there is no option to add or remove them? It just seems to be there just for read-only purposes with no ability to add. Am I wrong!?!?
Please sign in to leave a comment.
Hello!
Since your project is based on CMake, please take a look at this thread - https://stackoverflow.com/questions/29191855/what-is-the-proper-way-to-use-pkg-config-from-cmake. Also, the CMake documentation might be useful - https://cmake.org/cmake/help/latest/module/FindPkgConfig.html.
CLion takes this information from the project model. Indeed it's not possible to add them by right-clicking; they should be added through the project model (CMake, in your case).