2021-09-23 11:05:53 -07:00
|
|
|
# Once done these will be defined:
|
|
|
|
#
|
2022-03-16 15:11:06 -07:00
|
|
|
# LIBDRM_FOUND LIBDRM_INCLUDE_DIRS LIBDRM_LIBRARIES
|
2021-09-23 11:05:53 -07:00
|
|
|
|
|
|
|
find_package(PkgConfig QUIET)
|
2022-03-16 15:11:06 -07:00
|
|
|
if(PKG_CONFIG_FOUND)
|
|
|
|
pkg_check_modules(_LIBDRM QUIET libdrm)
|
2021-09-23 11:05:53 -07:00
|
|
|
endif()
|
|
|
|
|
2022-03-16 15:11:06 -07:00
|
|
|
find_path(
|
|
|
|
LIBDRM_INCLUDE_DIR
|
|
|
|
NAMES libdrm/drm_fourcc.h
|
|
|
|
HINTS ${_LIBDRM_INCLUDE_DIRS}
|
|
|
|
PATHS /usr/include /usr/local/include /opt/local/include)
|
2021-09-23 11:05:53 -07:00
|
|
|
|
2022-03-16 15:11:06 -07:00
|
|
|
find_library(
|
|
|
|
LIBDRM_LIB
|
|
|
|
NAMES drm libdrm
|
|
|
|
HINTS ${_LIBDRM_LIBRARY_DIRS}
|
|
|
|
PATHS /usr/lib /usr/local/lib /opt/local/lib)
|
2021-09-23 11:05:53 -07:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2022-03-16 15:11:06 -07:00
|
|
|
find_package_handle_standard_args(Libdrm DEFAULT_MSG LIBDRM_LIB
|
|
|
|
LIBDRM_INCLUDE_DIR)
|
2021-09-23 11:05:53 -07:00
|
|
|
mark_as_advanced(LIBDRM_INCLUDE_DIR LIBDRM_LIB)
|
|
|
|
|
|
|
|
if(LIBDRM_FOUND)
|
2022-03-16 15:11:06 -07:00
|
|
|
set(LIBDRM_INCLUDE_DIRS ${LIBDRM_INCLUDE_DIR})
|
|
|
|
set(LIBDRM_LIBRARIES ${LIBDRM_LIB})
|
|
|
|
|
|
|
|
if(NOT TARGET Libdrm::Libdrm)
|
|
|
|
add_library(Libdrm::Libdrm INTERFACE IMPORTED)
|
|
|
|
set_target_properties(
|
|
|
|
Libdrm::Libdrm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
|
|
|
"${LIBDRM_INCLUDE_DIRS}")
|
|
|
|
endif()
|
2021-09-23 11:05:53 -07:00
|
|
|
endif()
|