From 75cc1725ad05c21c668b80bb5105016f149e0bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 3 Mar 2019 16:14:55 +0100 Subject: [PATCH] CMake: link both GlfwApplication and Sdl2Application to EGL, if needed. This is already done in the FindMagnum module for both, but not in the source tree -- for SDL2 it was done in the FindSDL2 module (seems a strange place) and for GLFW nowhere. To make things consistent, I'm doing that in the Platform CMakeLists now and removed it from FindSDL2. Hopefully this doesn't break anyone's workflow (static builds of SDL2/GLFW?). In that case we would need to re-add it to the Find modules as well. --- modules/FindSDL2.cmake | 7 ------- src/Magnum/Platform/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index 33fce18fc..559e1d5e6 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -145,13 +145,6 @@ if(NOT TARGET SDL2::SDL2) set_property(TARGET SDL2::SDL2 APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_SDL2_FRAMEWORK_LIBRARIES}) endif() - - # Link also EGL library, if on ES (and not on WebGL) - if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL) - find_package(EGL REQUIRED) - set_property(TARGET SDL2::SDL2 APPEND PROPERTY - INTERFACE_LINK_LIBRARIES EGL::EGL) - endif() else() add_library(SDL2::SDL2 INTERFACE IMPORTED) endif() diff --git a/src/Magnum/Platform/CMakeLists.txt b/src/Magnum/Platform/CMakeLists.txt index 5cef92527..c9b28d077 100644 --- a/src/Magnum/Platform/CMakeLists.txt +++ b/src/Magnum/Platform/CMakeLists.txt @@ -169,6 +169,12 @@ if(WITH_GLFWAPPLICATION) endif() endif() + # Link also EGL library, if on ES (and not on WebGL) + if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL) + find_package(EGL REQUIRED) + target_link_libraries(MagnumGlfwApplication PUBLIC EGL::EGL) + endif() + install(FILES ${MagnumGlfwApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform) install(TARGETS MagnumGlfwApplication RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} @@ -272,6 +278,12 @@ if(WITH_SDL2APPLICATION) endif() endif() + # Link also EGL library, if on ES (and not on WebGL) + if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL) + find_package(EGL REQUIRED) + target_link_libraries(MagnumSdl2Application PUBLIC EGL::EGL) + endif() + install(FILES ${MagnumSdl2Application_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform) install(TARGETS MagnumSdl2Application RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}