diff options
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/FindGBM.cmake | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cmake/modules/FindGBM.cmake b/cmake/modules/FindGBM.cmake index 1e4436d8cd..18df89e1a4 100644 --- a/cmake/modules/FindGBM.cmake +++ b/cmake/modules/FindGBM.cmake @@ -29,11 +29,24 @@ find_package_handle_standard_args(GBM REQUIRED_VARS GBM_LIBRARY GBM_INCLUDE_DIR VERSION_VAR GBM_VERSION) +include(CheckCSourceCompiles) +set(CMAKE_REQUIRED_LIBRARIES ${GBM_LIBRARY}) +check_c_source_compiles("#include <gbm.h> + + int main() + { + gbm_bo_map(NULL, 0, 0, 0, 0, GBM_BO_TRANSFER_WRITE, NULL, NULL); + } + " GBM_HAS_BO_MAP) + if(GBM_FOUND) set(GBM_LIBRARIES ${GBM_LIBRARY}) set(GBM_INCLUDE_DIRS ${GBM_INCLUDE_DIR}) set(GBM_DEFINITIONS -DHAVE_GBM=1) - if(NOT TARGET GBM::GBM) + if(GBM_HAS_BO_MAP) + list(APPEND GBM_DEFINITIONS -DHAS_GBM_BO_MAP=1) + endif() + if(NOT TARGET GBM::GBM) add_library(GBM::GBM UNKNOWN IMPORTED) set_target_properties(GBM::GBM PROPERTIES IMPORTED_LOCATION "${GBM_LIBRARY}" |