diff options
Diffstat (limited to 'cmake/modules/FindEGL.cmake')
| -rw-r--r-- | cmake/modules/FindEGL.cmake | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake new file mode 100644 index 0000000..93fa530 --- /dev/null +++ b/cmake/modules/FindEGL.cmake | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindEGL | ||
| 3 | # ------- | ||
| 4 | # Finds the EGL library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # EGL_FOUND - system has EGL | ||
| 9 | # EGL_INCLUDE_DIRS - the EGL include directory | ||
| 10 | # EGL_LIBRARIES - the EGL libraries | ||
| 11 | # EGL_DEFINITIONS - the EGL definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # EGL::EGL - The EGL library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_EGL egl QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(EGL_INCLUDE_DIR EGL/egl.h | ||
| 22 | PATHS ${PC_EGL_INCLUDEDIR}) | ||
| 23 | |||
| 24 | find_library(EGL_LIBRARY NAMES EGL egl | ||
| 25 | PATHS ${PC_EGL_LIBDIR}) | ||
| 26 | |||
| 27 | set(EGL_VERSION ${PC_EGL_VERSION}) | ||
| 28 | |||
| 29 | include(FindPackageHandleStandardArgs) | ||
| 30 | find_package_handle_standard_args(EGL | ||
| 31 | REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR | ||
| 32 | VERSION_VAR EGL_VERSION) | ||
| 33 | |||
| 34 | if(EGL_FOUND) | ||
| 35 | set(EGL_LIBRARIES ${EGL_LIBRARY}) | ||
| 36 | set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) | ||
| 37 | set(EGL_DEFINITIONS -DHAS_EGL=1) | ||
| 38 | |||
| 39 | if(NOT TARGET EGL::EGL) | ||
| 40 | add_library(EGL::EGL UNKNOWN IMPORTED) | ||
| 41 | set_target_properties(EGL::EGL PROPERTIES | ||
| 42 | IMPORTED_LOCATION "${EGL_LIBRARY}" | ||
| 43 | INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" | ||
| 44 | INTERFACE_COMPILE_DEFINITIONS HAS_EGL=1) | ||
| 45 | endif() | ||
| 46 | endif() | ||
| 47 | |||
| 48 | mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY) | ||
