File: pcl_find_libusb.cmake

package info (click to toggle)
pcl 1.13.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 143,524 kB
  • sloc: cpp: 518,578; xml: 28,792; ansic: 13,676; python: 334; lisp: 93; sh: 49; makefile: 30
file content (34 lines) | stat: -rw-r--r-- 1,242 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
#pcl_find_libusb is used due to VCPKG making impossible to use local findXX modules.
# and VCPKG findlibusb doesn't create the libusb targets.

# Find and set libusb
find_package(libusb)

if(TARGET libusb::libusb)
  #libusb target is found by the find_package script. 
  #VCPKG skip PCLs findlibusb and sets its own variables which is handled below.
  return()
endif()

#Handle VCPKG definitions
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libusb DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS)

mark_as_advanced(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES)

if(libusb_FOUND)
  add_library(libusb::libusb UNKNOWN IMPORTED)
  if(${LIBUSB_INCLUDE_DIRS})
    set_target_properties(libusb::libusb PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIRS}")
  endif()
  if(EXISTS "${LIBUSB_LIBRARY}")
    set_target_properties(libusb::libusb PROPERTIES IMPORTED_LOCATION ${LIBUSB_LIBRARY})
  endif()
  if(EXISTS "${LIBUSB_LIBRARY_DEBUG}")
    set_target_properties(libusb::libusb PROPERTIES IMPORTED_LOCATION_DEBUG ${LIBUSB_LIBRARY_DEBUG})
  endif()
  if(EXISTS "${LIBUSB_LIBRARY_RELEASE}")
    set_target_properties(libusb::libusb PROPERTIES IMPORTED_LOCATION_RELEASE ${LIBUSB_LIBRARY_RELEASE})
  endif()
endif()