Fix FindEGL on Emscripten

Fixes were upstreamed with commit
3b0bf71a72789eb2b79310b4f67602115e347f56 in extra-cmake-modules and this
brings the file in sync.

Change-Id: Ica3a29fd091afa669f29a3e9775e637566f1cb97
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Simon Hausmann 2019-08-30 10:38:38 +02:00
parent 0bcd50b40a
commit 76897659f8

View File

@ -129,25 +129,33 @@ int main(int argc, char *argv[]) {
cmake_pop_check_state() cmake_pop_check_state()
set(required_vars EGL_INCLUDE_DIR HAVE_EGL)
if(NOT EMSCRIPTEN)
list(APPEND required_vars EGL_LIBRARY)
endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EGL find_package_handle_standard_args(EGL
FOUND_VAR FOUND_VAR
EGL_FOUND EGL_FOUND
REQUIRED_VARS REQUIRED_VARS
EGL_LIBRARY ${required_vars}
EGL_INCLUDE_DIR
HAVE_EGL
VERSION_VAR VERSION_VAR
EGL_VERSION EGL_VERSION
) )
if(EGL_FOUND AND NOT TARGET EGL::EGL) if(EGL_FOUND AND NOT TARGET EGL::EGL)
add_library(EGL::EGL UNKNOWN IMPORTED) if (EMSCRIPTEN)
set_target_properties(EGL::EGL PROPERTIES add_library(EGL::EGL INTERFACE IMPORTED)
IMPORTED_LOCATION "${EGL_LIBRARY}" # Nothing further to be done, system include paths have headers and linkage is implicit.
INTERFACE_COMPILE_OPTIONS "${EGL_DEFINITIONS}" else()
INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" add_library(EGL::EGL UNKNOWN IMPORTED)
) set_target_properties(EGL::EGL PROPERTIES
IMPORTED_LOCATION "${EGL_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${EGL_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}"
)
endif()
endif() endif()
mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL) mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL)