-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
208 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#[=======================================================================[.rst: | ||
Findudev | ||
------- | ||
Finds the udev library. | ||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
This module provides the following imported targets, if found: | ||
``udev::udev`` | ||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
This will define the following variables: | ||
``udev_FOUND`` | ||
True if the system has udev. | ||
``udev_VERSION`` | ||
The version of udev which was found. | ||
``udev_INCLUDE_DIR`` | ||
Include directories needed to use udev. | ||
``udev_LIBRARIES`` | ||
Libraries needed to link to udev. | ||
Cache Variables | ||
^^^^^^^^^^^^^^^ | ||
The following cache variables may also be set: | ||
. | ||
``GTK_LIBRARY`` | ||
The path to the udev library. | ||
#]=======================================================================] | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(PC_udev QUIET udev) | ||
endif() | ||
|
||
find_path( | ||
udev_INCLUDE_DIR | ||
NAMES libudev.h | ||
HINTS ${PC_udev_INCLUDE_DIRS} | ||
PATHS /usr/include /usr/local/include | ||
DOC "udev include directory" | ||
) | ||
|
||
find_library( | ||
udev_LIBRARIES | ||
NAMES udev | ||
HINTS ${PC_udev_LIBRARY_DIRS} | ||
PATHS /usr/lib /usr/local/lib | ||
DOC "udev location" | ||
) | ||
|
||
set(udev_VERSION ${PC_udev_VERSION}) | ||
set(udev_ERROR_REASON "Ensure udev libraries are available in local library paths.") | ||
|
||
find_package_handle_standard_args( | ||
udev | ||
REQUIRED_VARS udev_LIBRARIES udev_INCLUDE_DIR | ||
REASON_FAILURE_MESSAGE "${udev_ERROR_REASON}" | ||
) | ||
mark_as_advanced(udev_INCLUDE_DIR udev_LIBRARIES) | ||
unset(udev_ERROR_REASON) | ||
|
||
if(udev_FOUND) | ||
if(NOT TARGET udev::udev) | ||
add_library(udev::udev UNKNOWN IMPORTED) | ||
set_property(TARGET udev::udev PROPERTY IMPORTED_LOCATION "${udev_LIBRARIES}") | ||
|
||
message(AUTHOR_WARNING "udev libraries are ${udev_LIBRARIES}") | ||
set_target_properties( | ||
udev::udev | ||
PROPERTIES | ||
INTERFACE_COMPILE_OPTIONS "${PC_udev_CFLAGS_OTHER}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${PC_udev_INCLUDE_DIR}" | ||
INTERFACE_LINK_LIBRARIES "${udev_LIBRARIES}" | ||
VERSION "${udev_VERSION}" | ||
) | ||
endif() | ||
endif() | ||
|
||
include(FeatureSummary) | ||
set_package_properties(udev PROPERTIES URL "https://www.freedesktop.org/software/systemd/man/latest/libudev.html" DESCRIPTION "libudev.h provides an API to introspect and enumerate devices on the local system.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#[=======================================================================[.rst: | ||
Finduhid | ||
------- | ||
Finds the usbhid library. | ||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
This module provides the following imported targets, if found: | ||
``uhid::uhid`` | ||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
This will define the following variables: | ||
``uhid_FOUND`` | ||
True if the system has uhid. | ||
``uhid_LIBRARIES`` | ||
The location of the usbhid library. | ||
``uhid_INCLUDE_DIR`` | ||
Include directories needed to use uhid. | ||
#]=======================================================================] | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_path( | ||
uhid_INCLUDE_DIR | ||
NAMES usbhid.h /dev/usb/usbhid.h | ||
PATHS /usr/include /usr/local/include | ||
DOC "uhid include directory" | ||
) | ||
|
||
find_library( | ||
uhid_LIBRARIES | ||
NAMES usbhid | ||
PATHS /usr/lib /usr/local/lib | ||
DOC "uhid location" | ||
) | ||
|
||
set(uhid_VERSION ${CMAKE_HOST_SYSTEM_VERSION}) | ||
|
||
find_package_handle_standard_args( | ||
uhid | ||
REQUIRED_VARS uhid_INCLUDE_DIR uhid_LIBRARIES | ||
VERSION_VAR uhid_VERSION | ||
REASON_FAILURE_MESSAGE "Ensure that uhid is installed on the system." | ||
) | ||
mark_as_advanced(uhid_INCLUDE_DIR uhid_LIBRARY) | ||
|
||
if(uhid_FOUND) | ||
if(NOT TARGET uhid::uhid) | ||
add_library(uhid::uhid MODULE IMPORTED) | ||
set_property(TARGET uhid::uhid PROPERTY IMPORTED_LOCATION "${uhid_LIBRARIES}") | ||
|
||
set_target_properties( | ||
uhid::uhid | ||
PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${uhid_INCLUDE_DIR}" | ||
INTERFACE_LINK_LIBRARIES "${uhid_LIBRARIES}" | ||
VERSION ${uhid_VERSION} | ||
) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters