-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12294 from fwcd/linux-static-hidapi-udev
FindLibudev: Link hidapi and libusb with libudev in static builds on Linux
- Loading branch information
Showing
3 changed files
with
92 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This file is part of Mixxx, Digital DJ'ing software. | ||
# Copyright (C) 2001-2023 Mixxx Development Team | ||
# Distributed under the GNU General Public Licence (GPL) version 2 or any later | ||
# later version. See the LICENSE file for details. | ||
|
||
#[=======================================================================[.rst: | ||
FindLibudev | ||
-------- | ||
Finds the libudev (userspace device manager) library. | ||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
This module provides the following imported targets, if found: | ||
``Libudev::Libudev`` | ||
The libudev library | ||
#]=======================================================================] | ||
|
||
find_package(PkgConfig QUIET) | ||
if(PkgConfig_FOUND) | ||
pkg_check_modules(PC_Libudev QUIET libudev) | ||
endif() | ||
|
||
find_path(Libudev_INCLUDE_DIR | ||
NAMES libudev.h | ||
PATHS ${PC_Libudev_INCLUDE_DIRS} | ||
DOC "The libudev include directory") | ||
mark_as_advanced(Libudev_INCLUDE_DIR) | ||
|
||
find_library(Libudev_LIBRARY | ||
NAMES udev | ||
PATH ${PC_Libudev_LIBRARY_DIRS} | ||
DOC "The libudev library" | ||
) | ||
mark_as_advanced(Libudev_LIBRARY) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
Libudev | ||
REQUIRED_VARS Libudev_LIBRARY Libudev_INCLUDE_DIR | ||
VERSION_VAR Libudev_VERSION | ||
) | ||
|
||
if(Libudev_FOUND) | ||
set(Libudev_LIBRARIES "${Libudev_LIBRARY}") | ||
set(Libudev_INCLUDE_DIRS "${Libudev_INCLUDE_DIR}") | ||
set(Libudev_DEFINITIONS ${PC_Libudev_CFLAGS_OTHER}) | ||
|
||
if(NOT TARGET Libudev::Libudev) | ||
add_library(Libudev::Libudev UNKNOWN IMPORTED) | ||
set_target_properties(Libudev::Libudev | ||
PROPERTIES | ||
IMPORTED_LOCATION "${Libudev_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${PC_Libudev_CFLAGS_OTHER}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${Libudev_INCLUDE_DIR}" | ||
) | ||
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