find_package(PkgConfig)
pkg_check_modules(PC_LIBUDEV libudev)

find_library(UDEV_LIBRARY
        NAMES
        udev
        PATHS
        ${PC_LIBUDEV_LIBRARY_DIRS}
        ${PC_LIBUDEV_LIBDIR}
        )

find_path(UDEV_INCLUDE_DIR
        NAMES
        libudev.h
        PATHS
        ${PC_LIBUDEV_INCLUDE_DIRS}
        ${PC_LIBUDEV_INCLUDEDIR}
        )

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UDEV
        DEFAULT_MSG
        UDEV_INCLUDE_DIR
        UDEV_LIBRARY
        )

if(UDEV_FOUND)
    mark_as_advanced(
            UDEV_INCLUDE_DIR
            UDEV_LIBRARY)
else()
    message(WARNING "Could not find udev")
endif()
