direwolf/cmake/modules/Findhidapi.cmake
Martin Cooper b8fdf013c5 Build changes for the use of CM108 for PTT on Mac
The CMake changes are slightly complicated by the Windows build using
a local copy of some hidapi files, for some reason, instead of using
the hidapi library itself. The Mac version uses hidapi in the same way
as other libraries.

In the CMake files, it is unclear to me whether "elseif (NOT WIN32 AND
NOT CYGWIN)" means the same thing as "elseif (APPLE)", so they are
treated separately in order to avoid breaking other build types.
2023-11-15 17:02:32 -08:00

44 lines
818 B
CMake

# - Try to find hidapi
#
# HIDAPI_FOUND - system has hidapi
# HIDAPI_LIBRARIES - location of the library for hidapi
# HIDAPI_INCLUDE_DIRS - location of the include files for hidapi
set(HIDAPI_ROOT_DIR
"${HIDAPI_ROOT_DIR}"
CACHE
PATH
"Directory to search for hidapi")
# no need to check pkg-config
find_path(HIDAPI_INCLUDE_DIRS
NAMES
hidapi.h
PATHS
/usr/local/include
/usr/include
/opt/local/include
HINTS
${HIDAPI_ROOT_DIR}
PATH_SUFFIXES
hidapi
)
find_library(HIDAPI_LIBRARIES
NAMES
hidapi
PATHS
/usr/local/lib
/usr/lib
/usr/lib64
/opt/local/lib
HINTS
${HIDAPI_ROOT_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIDAPI DEFAULT_MSG HIDAPI_INCLUDE_DIRS HIDAPI_LIBRARIES)
mark_as_advanced(HIDAPI_INCLUDE_DIRS HIDAPI_LIBRARIES)