diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-24 09:47:02 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-24 11:33:48 +0200 |
commit | 3b0bf71a72789eb2b79310b4f67602115e347f56 (patch) | |
tree | 44c4c61acf04b68338b464225054e4fa18adb2b1 /find-modules | |
parent | 6f95e6752d791b451d503ec363c5cafbe0bc0b77 (diff) | |
download | extra-cmake-modules-3b0bf71a72789eb2b79310b4f67602115e347f56.tar.gz extra-cmake-modules-3b0bf71a72789eb2b79310b4f67602115e347f56.tar.bz2 |
Fix FindEGL when using Emscripten
When using the Emscripten toolchain, there is no library linkage
necessary (there is no library) and the system include search paths
provide EGL headers.
Reviewed By: vkrause
Differential Revision: https://phabricator.kde.org/D24182
Diffstat (limited to 'find-modules')
-rw-r--r-- | find-modules/FindEGL.cmake | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/find-modules/FindEGL.cmake b/find-modules/FindEGL.cmake index de271a11..48e51728 100644 --- a/find-modules/FindEGL.cmake +++ b/find-modules/FindEGL.cmake @@ -129,25 +129,33 @@ int main(int argc, char *argv[]) { cmake_pop_check_state() +set(required_vars EGL_INCLUDE_DIR HAVE_EGL) +if(NOT EMSCRIPTEN) + list(APPEND required_vars EGL_LIBRARY) +endif() + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(EGL FOUND_VAR EGL_FOUND REQUIRED_VARS - EGL_LIBRARY - EGL_INCLUDE_DIR - HAVE_EGL + ${required_vars} VERSION_VAR EGL_VERSION ) if(EGL_FOUND AND NOT TARGET EGL::EGL) - 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}" - ) + if (EMSCRIPTEN) + add_library(EGL::EGL INTERFACE IMPORTED) + # Nothing further to be done, system include paths have headers and linkage is implicit. + else() + 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() mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL) |