The problem can also be avoided like this, so no need for dependencies and it will still work with older glib versions

#if !GLIB_CHECK_VERSION(2, 36, 0)
        g_type_init();
#endif
#if !GLIB_CHECK_VERSION(2, 31, 0)
        g_thread_init(NULL);
#endif

I need to check if the g_type_init is necessary or not.