mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
More flexible libusb-1.0 package finder script
This commit is contained in:
parent
b3b70a81cd
commit
17ba3e4a06
@ -17,56 +17,60 @@
|
|||||||
|
|
||||||
include (LibFindMacros)
|
include (LibFindMacros)
|
||||||
|
|
||||||
# Use pkg-config to get hints about paths, libs and, flags
|
libfind_pkg_detect (libusb libusb-1.0 FIND_PATH libusb.h PATH_SUFFIXES libusb-1.0 FIND_LIBRARY libusb-1.0)
|
||||||
libfind_pkg_check_modules (libusb_PC libusb-1.0)
|
# # Use pkg-config to get hints about paths, libs and, flags
|
||||||
|
# libfind_pkg_check_modules (libusb_PC libusb-1.0)
|
||||||
|
|
||||||
# Include dir
|
# # Include dir
|
||||||
find_path (libusb_INCLUDE_DIR
|
# find_path (libusb_INCLUDE_DIR
|
||||||
libusb.h
|
# libusb.h
|
||||||
PATHS ${libusb_PC_INCLUDE_DIRS}
|
# PATHS ${libusb_PC_INCLUDE_DIRS}
|
||||||
PATH_SUFFIXES libusb-1.0
|
# PATH_SUFFIXES libusb-1.0
|
||||||
)
|
# )
|
||||||
|
|
||||||
# Library
|
# # Library
|
||||||
if (libusb_STATIC)
|
# if (libusb_STATIC)
|
||||||
find_library (libusb_LIBRARY
|
# find_library (libusb_LIBRARY
|
||||||
NAMES usb-1.0
|
# NAMES usb-1.0
|
||||||
PATHS ${libusb_PC_STATIC_LIBRARY_DIRS}
|
# PATHS ${libusb_PC_STATIC_LIBRARY_DIRS}
|
||||||
)
|
# PATH_SUFFIXES static
|
||||||
else ()
|
# )
|
||||||
find_library (libusb_LIBRARY
|
# else ()
|
||||||
NAMES usb-1.0
|
# find_library (libusb_LIBRARY
|
||||||
PATHS ${libusb_PC_LIBRARY_DIRS}
|
# NAMES usb-1.0
|
||||||
)
|
# PATHS ${libusb_PC_LIBRARY_DIRS}
|
||||||
endif ()
|
# )
|
||||||
set (libusb_PROCESS_INCLUDES libusb_INCLUDE_DIR)
|
# endif ()
|
||||||
set (libusb_PROCESS_LIBS libusb_LIBRARY)
|
# set (libusb_PROCESS_INCLUDES libusb_INCLUDE_DIR)
|
||||||
|
# set (libusb_PROCESS_LIBS libusb_LIBRARY)
|
||||||
libfind_process (libusb)
|
libfind_process (libusb)
|
||||||
|
|
||||||
include (FindPackageHandleStandardArgs)
|
# include (FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args (libusb
|
# find_package_handle_standard_args (libusb
|
||||||
REQUIRED_VARS
|
# REQUIRED_VARS
|
||||||
libusb_LIBRARY
|
# libusb_LIBRARY
|
||||||
libusb_INCLUDE_DIR
|
# libusb_INCLUDE_DIR
|
||||||
VERSION_VAR libusb_VERSION
|
# VERSION_VAR libusb_VERSION
|
||||||
)
|
# )
|
||||||
|
|
||||||
if (libusb_FOUND)
|
# if (libusb_FOUND)
|
||||||
set (libusb_LIBRARIES ${libusb_LIBRARY})
|
# set (libusb_LIBRARIES ${libusb_LIBRARY})
|
||||||
set (libusb_INCLUDE_DIRS ${libusb_INCLUDE_DIR})
|
# set (libusb_INCLUDE_DIRS ${libusb_INCLUDE_DIR})
|
||||||
set (libusb_DEFINITIONS ${libusb_CFLAGS_OTHER})
|
# set (libusb_DEFINITIONS ${libusb_CFLAGS_OTHER})
|
||||||
endif ()
|
# endif ()
|
||||||
|
|
||||||
if (libusb_FOUND AND NOT TARGET libusb::libusb)
|
if (libusb_FOUND AND NOT TARGET libusb::libusb)
|
||||||
add_library (libusb::libusb UNKNOWN IMPORTED)
|
add_library (libusb::libusb UNKNOWN IMPORTED)
|
||||||
set_target_properties (libusb::libusb PROPERTIES
|
set_target_properties (libusb::libusb PROPERTIES
|
||||||
IMPORTED_LOCATION "${libusb_LIBRARY}"
|
IMPORTED_LOCATION "${libusb_LIBRARY}"
|
||||||
INTERFACE_COMPILE_OPTIONS "${libusb_CFLAGS_OTHER}"
|
INTERFACE_COMPILE_OPTIONS "${libusb_CFLAGS_OTHER}"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${libusb_INCLUDE_DIR}"
|
INTERFACE_INCLUDE_DIRECTORIES "${libusb_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARAIES "${libusb_LIBRARIES}"
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
mark_as_advanced (
|
mark_as_advanced (
|
||||||
libusb_INCLUDE_DIR
|
libusb_INCLUDE_DIR
|
||||||
libusb_LIBRARY
|
libusb_LIBRARY
|
||||||
|
libusb_LIBRARIES
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user