Warn the user if pkg-config isn't installed

Helpfully suggest installing pkg-config if FindLibUSB.cmake fails.
This change should not impact the build mechanics.
This commit is contained in:
Ryan Tucker 2013-10-05 20:53:43 -04:00
commit c27a67fa63

View file

@ -41,6 +41,10 @@ set(LIBUSB_PATH
find_package ( PkgConfig )
if ( PKG_CONFIG_FOUND )
pkg_check_modules ( PKGCONFIG_LIBUSB libusb-1.0 )
else ( PKG_CONFIG_FOUND )
if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
message ( WARNING "Could not find pkg-config, which is a build dependency. If libusb-1.0 can't be found, please install pkg-config." )
endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
endif ( PKG_CONFIG_FOUND )
if ( PKGCONFIG_LIBUSB_FOUND )
@ -118,5 +122,5 @@ if ( LIBUSB_FOUND )
check_library_exists ( "${usb_LIBRARY}" libusb_handle_events_timeout_completed "" LIBUSB_VERSION_1.0 )
check_library_exists ( "${usb_LIBRARY}" libusb_get_version "" LIBUSB_VERSION_1.0 )
else ()
message ( FATAL_ERROR "libusb-1.0 not found - is it installed? If you're using a binary distribution, try setting -DLIBUSB_PATH=<path_to_libusb_files>." )
message ( FATAL_ERROR "libusb-1.0 not found - is it installed? If you're using a binary distribution, try setting -DLIBUSB_PATH=<path_to_libusb_files>. If pkg-config wasn't found, try installing it." )
endif ( LIBUSB_FOUND )