Skip to content

Commit

Permalink
CMake: fix USB detection with wrong pkgconfig info (e.g. cross-compil…
Browse files Browse the repository at this point in the history
…ing)
  • Loading branch information
hsattler committed May 28, 2009
1 parent 33afd94 commit 41867e5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CMakeModules/FindLibUSB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ if ( PKG_CONFIG_FOUND )
endif ( PKG_CONFIG_FOUND )

if ( PKGCONFIG_LIBUSB_FOUND )
set ( LibUSB_FOUND ${PKGCONFIG_LIBUSB_FOUND} )
set ( LibUSB_INCLUDE_DIRS ${PKGCONFIG_LIBUSB_INCLUDE_DIRS} )
foreach ( i ${PKGCONFIG_LIBUSB_LIBRARIES} )
string ( REGEX MATCH "[^-]*" ibase "${i}" )
Expand Down Expand Up @@ -81,15 +80,17 @@ else ( PKGCONFIG_LIBUSB_FOUND )
set ( LibUSB_LIBRARIES ${usb_LIBRARY} )
endif ( usb_LIBRARY )

if ( LibUSB_INCLUDE_DIRS AND LibUSB_LIBRARIES )
set ( LibUSB_FOUND true )
endif ( LibUSB_INCLUDE_DIRS AND LibUSB_LIBRARIES )
endif ( PKGCONFIG_LIBUSB_FOUND )

if ( LibUSB_INCLUDE_DIRS AND LibUSB_LIBRARIES )
set ( LibUSB_FOUND true )
endif ( LibUSB_INCLUDE_DIRS AND LibUSB_LIBRARIES )

if ( LibUSB_FOUND )
set ( CMAKE_REQUIRED_INCLUDES "${LibUSB_INCLUDE_DIRS}" )
check_include_file ( "{LibUSB_HEADER_FILE}" LibUSB_FOUND )
endif ( LibUSB_FOUND )

if ( LibUSB_FOUND )
check_library_exists ( "${usb_LIBRARY}" usb_open "" LibUSB_FOUND )
check_library_exists ( "${usb_LIBRARY}" libusb_get_device_list "" LibUSB_VERSION_1.0 )
Expand Down

0 comments on commit 41867e5

Please sign in to comment.