]> git.mxchange.org Git - flightgear.git/blob - CMakeModules/FindUDev.cmake
Fix Mac data dir finding.
[flightgear.git] / CMakeModules / FindUDev.cmake
1 # Configure libudev environment
2 #
3 # UDEV_FOUND - system has a libudev
4 # UDEV_INCLUDE_DIR - where to find header files
5 # UDEV_LIBRARIES - the libraries to link against udev
6 # UDEV_STABLE - it's true when is the version greater or equals to 143 - version when the libudev was stabilized in its API
7 #
8 # copyright (c) 2011 Petr Vanek <petr@scribus.info>
9 # Redistribution and use of this file is allowed according to the terms of the BSD license.
10 #
11
12 FIND_PATH(
13     UDEV_INCLUDE_DIR
14     libudev.h
15     /usr/include
16     /usr/local/include
17     ${UDEV_PATH_INCLUDES}
18 )
19
20 FIND_LIBRARY(
21     UDEV_LIBRARIES
22     NAMES udev libudev
23     PATHS ${ADDITIONAL_LIBRARY_PATHS}
24         ${UDEV_PATH_LIB}
25 )
26
27 IF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
28     SET(UDEV_FOUND "YES")
29     execute_process(COMMAND pkg-config --atleast-version=143 libudev RESULT_VARIABLE UDEV_STABLE)
30     # retvale is 0 of the condition is "true" so we need to negate the value...
31     if (UDEV_STABLE)
32         set(UDEV_STABLE 0)
33     else (UDEV_STABLE)
34         set(UDEV_STABLE 1)
35     endif (UDEV_STABLE)
36     message(STATUS "libudev stable: ${UDEV_STABLE}")
37 ENDIF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
38
39 IF (UDEV_FOUND)
40     MESSAGE(STATUS "Found UDev: ${UDEV_LIBRARIES}")
41     MESSAGE(STATUS "   include: ${UDEV_INCLUDE_DIR}")
42 ELSE (UDEV_FOUND)
43     MESSAGE(STATUS "UDev not found.")
44     MESSAGE(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include")
45     MESSAGE(STATUS "      currently found includes: ${UDEV_INCLUDE_DIR}")
46     MESSAGE(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib")
47     MESSAGE(STATUS "      currently found libs: ${UDEV_LIBRARIES}")
48     IF (UDev_FIND_REQUIRED)
49         MESSAGE(FATAL_ERROR "Could not find UDev library")
50     ENDIF (UDev_FIND_REQUIRED)
51 ENDIF (UDEV_FOUND)