Blame cmake/FindUDev.cmake

Packit 1fb8d4
# razor-de: Configure libudev environment
Packit 1fb8d4
#
Packit 1fb8d4
# UDEV_FOUND - system has a libudev
Packit 1fb8d4
# UDEV_INCLUDE_DIR - where to find header files
Packit 1fb8d4
# UDEV_LIBRARIES - the libraries to link against udev
Packit 1fb8d4
# UDEV_STABLE - it's true when is the version greater or equals to 143 - version when the libudev was stabilized in its API
Packit 1fb8d4
#
Packit 1fb8d4
# copyright (c) 2011 Petr Vanek <petr@scribus.info>
Packit 1fb8d4
# Redistribution and use is allowed according to the terms of the BSD license.
Packit 1fb8d4
#
Packit 1fb8d4
Packit 1fb8d4
FIND_PATH(
Packit 1fb8d4
    UDEV_INCLUDE_DIR
Packit 1fb8d4
    libudev.h
Packit 1fb8d4
    /usr/include
Packit 1fb8d4
    /usr/local/include
Packit 1fb8d4
    ${UDEV_PATH_INCLUDES}
Packit 1fb8d4
)
Packit 1fb8d4
Packit 1fb8d4
FIND_LIBRARY(
Packit 1fb8d4
    UDEV_LIBRARIES
Packit 1fb8d4
    NAMES udev libudev
Packit 1fb8d4
    PATHS
Packit 1fb8d4
        /usr/lib${LIB_SUFFIX}
Packit 1fb8d4
        /usr/local/lib${LIB_SUFFIX}
Packit 1fb8d4
        ${UDEV_PATH_LIB}
Packit 1fb8d4
)
Packit 1fb8d4
Packit 1fb8d4
IF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
Packit 1fb8d4
    SET(UDEV_FOUND "YES")
Packit 1fb8d4
    execute_process(COMMAND pkg-config --atleast-version=143 libudev RESULT_VARIABLE UDEV_STABLE)
Packit 1fb8d4
    # retvale is 0 of the condition is "true" so we need to negate the value...
Packit 1fb8d4
    if (UDEV_STABLE)
Packit 1fb8d4
set(UDEV_STABLE 0)
Packit 1fb8d4
    else (UDEV_STABLE)
Packit 1fb8d4
set(UDEV_STABLE 1)
Packit 1fb8d4
    endif (UDEV_STABLE)
Packit 1fb8d4
    message(STATUS "libudev stable: ${UDEV_STABLE}")
Packit 1fb8d4
ENDIF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
Packit 1fb8d4
Packit 1fb8d4
IF (UDEV_FOUND)
Packit 1fb8d4
    MESSAGE(STATUS "Found UDev: ${UDEV_LIBRARIES}")
Packit 1fb8d4
    MESSAGE(STATUS " include: ${UDEV_INCLUDE_DIR}")
Packit 1fb8d4
ELSE (UDEV_FOUND)
Packit 1fb8d4
    MESSAGE(STATUS "UDev not found.")
Packit 1fb8d4
    MESSAGE(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include")
Packit 1fb8d4
    MESSAGE(STATUS " currently found includes: ${UDEV_INCLUDE_DIR}")
Packit 1fb8d4
    MESSAGE(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib")
Packit 1fb8d4
    MESSAGE(STATUS " currently found libs: ${UDEV_LIBRARIES}")
Packit 1fb8d4
    IF (UDev_FIND_REQUIRED)
Packit 1fb8d4
        MESSAGE(FATAL_ERROR "Could not find UDev library")
Packit 1fb8d4
    ENDIF (UDev_FIND_REQUIRED)
Packit 1fb8d4
ENDIF (UDEV_FOUND)