diff options
| author | Simon Hausmann <simon.hausmann@qt.io> | 2019-02-12 16:53:36 +0100 | 
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-02-12 16:54:01 +0100 | 
| commit | 0b47899c1b92b0781367179d4255f99e2bb41518 (patch) | |
| tree | 5662cf6a84fd91c5f01cc79bc965b595b148803a | |
| parent | b23f4198a22a7bdc6cdbc5f8a63e1fd94e8f8bdd (diff) | |
| download | extra-cmake-modules-0b47899c1b92b0781367179d4255f99e2bb41518.tar.gz extra-cmake-modules-0b47899c1b92b0781367179d4255f99e2bb41518.tar.bz2 | |
Add compile check to FindEGL
Perform additional sanity checking by doing a compile test.
Differential Revision: https://phabricator.kde.org/D18960
| -rw-r--r-- | find-modules/FindEGL.cmake | 19 | 
1 files changed, 18 insertions, 1 deletions
| diff --git a/find-modules/FindEGL.cmake b/find-modules/FindEGL.cmake index b8787d8b..5277d123 100644 --- a/find-modules/FindEGL.cmake +++ b/find-modules/FindEGL.cmake @@ -61,6 +61,8 @@  #=============================================================================  include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) +include(CheckCXXSourceCompiles) +include(CMakePushCheckState)  ecm_find_package_version_check(EGL) @@ -115,6 +117,20 @@ if(EGL_INCLUDE_DIR)      unset(_EGL_version_lines)  endif() +cmake_push_check_state(RESET) +list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}") +list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}") + +check_cxx_source_compiles(" +#include <EGL/egl.h> + +int main(int argc, char *argv[]) { +    EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0; +    eglDestroyContext(dpy, ctx); +}" HAVE_EGL) + +cmake_pop_check_state() +  include(FindPackageHandleStandardArgs)  find_package_handle_standard_args(EGL      FOUND_VAR @@ -122,6 +138,7 @@ find_package_handle_standard_args(EGL      REQUIRED_VARS          EGL_LIBRARY          EGL_INCLUDE_DIR +        HAVE_EGL      VERSION_VAR          EGL_VERSION  ) @@ -135,7 +152,7 @@ if(EGL_FOUND AND NOT TARGET EGL::EGL)      )  endif() -mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR) +mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL)  # compatibility variables  set(EGL_LIBRARIES ${EGL_LIBRARY}) | 
