diff options
| author | Přemysl Eric Janouch <p@janouch.name> | 2025-08-02 18:55:31 +0200 | 
|---|---|---|
| committer | Přemysl Eric Janouch <p@janouch.name> | 2025-08-02 18:55:44 +0200 | 
| commit | c6f47a098198f22922100346d13f054de4aace32 (patch) | |
| tree | 70f76be89b9876ddbe555f4df8c78f05233ffae5 | |
| parent | c8f3b9ba38feb7464af8a2ebf4a62859c92fa17f (diff) | |
| download | usb-drivers-master.tar.gz usb-drivers-master.tar.xz usb-drivers-master.zip | |
CMakeLists.txt: improve searching for hidapiHEADorigin/mastermaster
Debian-based distributions don't include the CMake module.
| -rw-r--r-- | CMakeLists.txt | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e91b48..c240a16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,13 +41,16 @@ pkg_check_modules (libusb libusb-1.0)  # On MSYS2, the CMake package cannot link statically, but pkg-config can.  # On macOS, we explicitly want to use the CMake package. -if (WIN32) +if (NOT WIN32) +	find_package (hidapi QUIET) +	if (hidapi_FOUND) +		set (hidapi_INCLUDE_DIRS) +		set (hidapi_LIBRARY_DIRS) +		set (hidapi_LIBRARIES hidapi::hidapi) +	endif () +endif () +if (NOT hidapi_FOUND)  	pkg_search_module (hidapi hidapi hidapi-hidraw hidapi-libusb) -else () -	find_package (hidapi) -	set (hidapi_INCLUDE_DIRS) -	set (hidapi_LIBRARY_DIRS) -	set (hidapi_LIBRARIES hidapi::hidapi)  endif ()  option (WITH_LIBUSB "Compile with libusb-based utilities" ${libusb_FOUND}) | 
