Browse Source

modules: make FindEGL work on Emscripten.

pull/217/head
Vladimír Vondruš 9 years ago
parent
commit
b047c7ed5b
  1. 42
      modules/FindEGL.cmake

42
modules/FindEGL.cmake

@ -39,14 +39,17 @@
# #
# Library # Library
find_library(EGL_LIBRARY NAMES if(NOT CORRADE_TARGET_EMSCRIPTEN)
EGL find_library(EGL_LIBRARY NAMES
EGL
# ANGLE (CMake doesn't search for lib prefix on Windows) # ANGLE (CMake doesn't search for lib prefix on Windows)
libEGL libEGL
# On iOS a part of OpenGLES # On iOS a part of OpenGLES
OpenGLES) OpenGLES)
set(EGL_LIBRARY_NEEDED EGL_LIBRARY)
endif()
# Include dir # Include dir
find_path(EGL_INCLUDE_DIR NAMES find_path(EGL_INCLUDE_DIR NAMES
@ -57,20 +60,27 @@ find_path(EGL_INCLUDE_DIR NAMES
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EGL DEFAULT_MSG find_package_handle_standard_args(EGL DEFAULT_MSG
EGL_LIBRARY ${EGL_LIBRARY_NEEDED}
EGL_INCLUDE_DIR) EGL_INCLUDE_DIR)
if(NOT TARGET EGL::EGL) if(NOT TARGET EGL::EGL)
# Work around BUGGY framework support on macOS if(EGL_LIBRARY_NEEDED)
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html # Work around BUGGY framework support on macOS
if(APPLE AND ${EGL_LIBRARY} MATCHES "\\.framework$") # http://public.kitware.com/pipermail/cmake/2016-April/063179.html
add_library(EGL::EGL INTERFACE IMPORTED) if(APPLE AND ${EGL_LIBRARY} MATCHES "\\.framework$")
set_property(TARGET EGL::EGL APPEND PROPERTY add_library(EGL::EGL INTERFACE IMPORTED)
INTERFACE_LINK_LIBRARIES ${EGL_LIBRARY}) set_property(TARGET EGL::EGL APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${EGL_LIBRARY})
else()
add_library(EGL::EGL UNKNOWN IMPORTED)
set_property(TARGET EGL::EGL PROPERTY
IMPORTED_LOCATION ${EGL_LIBRARY})
endif()
else() else()
add_library(EGL::EGL UNKNOWN IMPORTED) # This won't work in CMake 2.8.12, but that affects Emscripten only so
set_property(TARGET EGL::EGL PROPERTY # I assume people building for that are not on that crap old Ubuntu
IMPORTED_LOCATION ${EGL_LIBRARY}) # 14.04 LTS
add_library(EGL::EGL INTERFACE IMPORTED)
endif() endif()
set_target_properties(EGL::EGL PROPERTIES set_target_properties(EGL::EGL PROPERTIES

Loading…
Cancel
Save