d928bfd1ea
As of 3.17 using find_package_handle_standard_args checks that the name of the FindXXX file and the first argument are the same case. Some modules used non-standard variables or the old singular variables instead of plurals. This normalizes variable usage to the new-style. Some CMakeLists.txt did custom error checking instead of propagating find_package errors. These were changes to call find_package with REQUIRED or without QUIET where needed and shortens the custom status messages. This helps users who want to enable that functionality see what precisely wasnt found.
34 lines
714 B
CMake
34 lines
714 B
CMake
# Once done these will be defined:
|
|
#
|
|
# UDEV_FOUND
|
|
# UDEV_INCLUDE_DIRS
|
|
# UDEV_LIBRARIES
|
|
|
|
find_package(PkgConfig QUIET)
|
|
if (PKG_CONFIG_FOUND)
|
|
pkg_check_modules(_UDEV QUIET libudev)
|
|
endif()
|
|
|
|
find_path(UDEV_INCLUDE_DIR
|
|
NAMES libudev.h
|
|
HINTS
|
|
${_UDEV_INCLUDE_DIRS}
|
|
PATHS
|
|
/usr/include /usr/local/include /opt/local/include)
|
|
|
|
find_library(UDEV_LIB
|
|
NAMES udev libudev
|
|
HINTS
|
|
${_UDEV_LIBRARY_DIRS}
|
|
PATHS
|
|
/usr/lib /usr/local/lib /opt/local/lib)
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(UDev DEFAULT_MSG UDEV_LIB UDEV_INCLUDE_DIR)
|
|
mark_as_advanced(UDEV_INCLUDE_DIR UDEV_LIB)
|
|
|
|
if(UDEV_FOUND)
|
|
set(UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR})
|
|
set(UDEV_LIBRARIES ${UDEV_LIB})
|
|
endif()
|