summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindGBM.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindGBM.cmake')
-rw-r--r--cmake/modules/FindGBM.cmake44
1 files changed, 44 insertions, 0 deletions
diff --git a/cmake/modules/FindGBM.cmake b/cmake/modules/FindGBM.cmake
new file mode 100644
index 0000000..ac95241
--- /dev/null
+++ b/cmake/modules/FindGBM.cmake
@@ -0,0 +1,44 @@
1# FindGBM
2# ----------
3# Finds the GBM library
4#
5# This will will define the following variables::
6#
7# GBM_FOUND - system has GBM
8# GBM_INCLUDE_DIRS - the GBM include directory
9# GBM_LIBRARIES - the GBM libraries
10# GBM_DEFINITIONS - the GBM definitions
11#
12# and the following imported targets::
13#
14# GBM::GBM - The GBM library
15
16if(PKG_CONFIG_FOUND)
17 pkg_check_modules(PC_GBM gbm QUIET)
18endif()
19
20find_path(GBM_INCLUDE_DIR NAMES gbm.h
21 PATHS ${PC_GBM_INCLUDEDIR})
22find_library(GBM_LIBRARY NAMES gbm
23 PATHS ${PC_GBM_LIBDIR})
24
25set(GBM_VERSION ${PC_GBM_VERSION})
26
27include(FindPackageHandleStandardArgs)
28find_package_handle_standard_args(GBM
29 REQUIRED_VARS GBM_LIBRARY GBM_INCLUDE_DIR
30 VERSION_VAR GBM_VERSION)
31
32if(GBM_FOUND)
33 set(GBM_LIBRARIES ${GBM_LIBRARY})
34 set(GBM_INCLUDE_DIRS ${GBM_INCLUDE_DIR})
35 set(GBM_DEFINITIONS -DHAVE_GBM=1)
36 if(NOT TARGET GBM::GBM)
37 add_library(GBM::GBM UNKNOWN IMPORTED)
38 set_target_properties(GBM::GBM PROPERTIES
39 IMPORTED_LOCATION "${GBM_LIBRARY}"
40 INTERFACE_INCLUDE_DIRECTORIES "${GBM_INCLUDE_DIR}")
41 endif()
42endif()
43
44mark_as_advanced(GBM_INCLUDE_DIR GBM_LIBRARY)