Search code examples
cmakeglib

What is the recommended way of using GLib2 with CMake


Id like to use GLib in my C application which uses CMake as the build system.

Now, I'm somehow confused how I should enable GLib in my CMakeLists.txt. Basically, you add libraries in cmake using the find_package command, so I tried, according to this bugreport

find_package(GLib2)

But nothing is found. In the GLib documentation it is suggested to use pkg-config, on the other hand.

What is the recommended way of enabling glib in a cmake-based project?


Solution

  • Give a look at my answer on using CMake with GTK

    It's pretty much the same with GLib.