Browse Source

modules: properly handle GLVND also in case of context libraries.

pull/255/head
Vladimír Vondruš 8 years ago
parent
commit
d0004865e5
  1. 21
      modules/FindMagnum.cmake

21
modules/FindMagnum.cmake

@ -722,11 +722,22 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# GLX context dependencies # GLX context dependencies
if(_component STREQUAL GlxContext) if(_component STREQUAL GlxContext)
find_package(X11) # With GLVND (since CMake 3.11) we need to explicitly link to
set_property(TARGET Magnum::${_component} APPEND PROPERTY # GLX because libOpenGL doesn't provide it. Also can't use
INTERFACE_INCLUDE_DIRECTORIES ${X11_INCLUDE_DIR}) # OpenGL_OpenGL_FOUND, because that one is set also if GLVND is
set_property(TARGET Magnum::${_component} APPEND PROPERTY # *not* found. If GLVND is not used, link to X11 instead.
INTERFACE_LINK_LIBRARIES ${X11_LIBRARIES}) set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL)
if(OPENGL_opengl_LIBRARY)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OpenGL::GLX)
else()
find_package(X11)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${X11_INCLUDE_DIR})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${X11_LIBRARIES})
endif()
# EGL context dependencies # EGL context dependencies
elseif(_component STREQUAL EglContext) elseif(_component STREQUAL EglContext)

Loading…
Cancel
Save