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.cmake28
1 files changed, 26 insertions, 2 deletions
diff --git a/cmake/modules/FindGBM.cmake b/cmake/modules/FindGBM.cmake
index ac95241..37a26a7 100644
--- a/cmake/modules/FindGBM.cmake
+++ b/cmake/modules/FindGBM.cmake
@@ -2,7 +2,7 @@
2# ---------- 2# ----------
3# Finds the GBM library 3# Finds the GBM library
4# 4#
5# This will will define the following variables:: 5# This will define the following variables::
6# 6#
7# GBM_FOUND - system has GBM 7# GBM_FOUND - system has GBM
8# GBM_INCLUDE_DIRS - the GBM include directory 8# GBM_INCLUDE_DIRS - the GBM include directory
@@ -29,11 +29,35 @@ find_package_handle_standard_args(GBM
29 REQUIRED_VARS GBM_LIBRARY GBM_INCLUDE_DIR 29 REQUIRED_VARS GBM_LIBRARY GBM_INCLUDE_DIR
30 VERSION_VAR GBM_VERSION) 30 VERSION_VAR GBM_VERSION)
31 31
32include(CheckCSourceCompiles)
33set(CMAKE_REQUIRED_LIBRARIES ${GBM_LIBRARY})
34check_c_source_compiles("#include <gbm.h>
35
36 int main()
37 {
38 gbm_bo_map(NULL, 0, 0, 0, 0, GBM_BO_TRANSFER_WRITE, NULL, NULL);
39 }
40 " GBM_HAS_BO_MAP)
41
42check_c_source_compiles("#include <gbm.h>
43
44 int main()
45 {
46 gbm_surface_create_with_modifiers(NULL, 0, 0, 0, NULL, 0);
47 }
48 " GBM_HAS_MODIFIERS)
49
32if(GBM_FOUND) 50if(GBM_FOUND)
33 set(GBM_LIBRARIES ${GBM_LIBRARY}) 51 set(GBM_LIBRARIES ${GBM_LIBRARY})
34 set(GBM_INCLUDE_DIRS ${GBM_INCLUDE_DIR}) 52 set(GBM_INCLUDE_DIRS ${GBM_INCLUDE_DIR})
35 set(GBM_DEFINITIONS -DHAVE_GBM=1) 53 set(GBM_DEFINITIONS -DHAVE_GBM=1)
36 if(NOT TARGET GBM::GBM) 54 if(GBM_HAS_BO_MAP)
55 list(APPEND GBM_DEFINITIONS -DHAS_GBM_BO_MAP=1)
56 endif()
57 if(GBM_HAS_MODIFIERS)
58 list(APPEND GBM_DEFINITIONS -DHAS_GBM_MODIFIERS=1)
59 endif()
60 if(NOT TARGET GBM::GBM)
37 add_library(GBM::GBM UNKNOWN IMPORTED) 61 add_library(GBM::GBM UNKNOWN IMPORTED)
38 set_target_properties(GBM::GBM PROPERTIES 62 set_target_properties(GBM::GBM PROPERTIES
39 IMPORTED_LOCATION "${GBM_LIBRARY}" 63 IMPORTED_LOCATION "${GBM_LIBRARY}"