find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
    if (GTK2_FIND_REQUIRED)
        set(_pkgconfig_REQUIRED REQUIRED)
    endif ()
    pkg_check_modules(GTK2 ${_pkgconfig_REQUIRED} gtk+-2.0)
    if (GTK2_LINK_LIBRARIES)
        set(GTK2_LIBRARIES ${GTK2_LINK_LIBRARIES}) # HACK
    endif ()
else ()
    find_path(GTK2_INCLUDE_DIRS gtk.h)
    # find_library(GTK2_LIBRARIES)
    if (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES)
        set(GTK2_FOUND 1)
        if (NOT GTK2_FIND_QUIETLY)
            message(STATUS "Found GTK2: ${GTK2_LIBRARIES}")
        endif ()
    elseif (GTK2_FIND_REQUIRED)
        message(SEND_ERROR "Could not find GTK2")
    elseif (NOT GTK2_FIND_QUIETLY)
        message(STATUS "Could not find GTK2")
    endif ()
endif ()
mark_as_advanced(GTK2_INCLUDE_DIRS GTK2_LIBRARIES)
