find_package(OpenGL) only works with glvnd and hardcodes glvnd paths, even though all these components are easily found with pkgconfig.. diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index ef28c99..b4df830 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -408,17 +408,26 @@ if(wxUSE_GUI) set(OPENGL_FOUND TRUE) set(OPENGL_LIBRARIES "-framework OpenGLES" "-framework QuartzCore" "-framework GLKit") else() - find_package(OpenGL) - if(OPENGL_FOUND) - foreach(gltarget OpenGL::GL OpenGL::GLU OpenGL::OpenGL) - if(TARGET ${gltarget}) - set(OPENGL_LIBRARIES ${gltarget} ${OPENGL_LIBRARIES}) - endif() - endforeach() - endif() - if(WXGTK3 AND OpenGL_EGL_FOUND AND wxUSE_GLCANVAS_EGL) + # find_package(OpenGL) + # if(OPENGL_FOUND) + # foreach(gltarget OpenGL::GL OpenGL::GLU OpenGL::OpenGL) + # if(TARGET ${gltarget}) + # set(OPENGL_LIBRARIES ${gltarget} ${OPENGL_LIBRARIES}) + # endif() + # endforeach() + # endif() + find_package(PkgConfig REQUIRED) + pkg_check_modules(GLU REQUIRED glu IMPORTED_TARGET GLOBAL) + add_library(OpenGL::GLU ALIAS PkgConfig::GLU) + pkg_check_modules(GL REQUIRED gl IMPORTED_TARGET GLOBAL) + add_library(OpenGL::GL ALIAS PkgConfig::GL) + pkg_check_modules(EGL REQUIRED egl IMPORTED_TARGET GLOBAL) + add_library(OpenGL::EGL ALIAS PkgConfig::EGL) + set(OPENGL_FOUND TRUE) + set(OpenGL_EGL_FOUND TRUE) + if(WXGTK3 AND wxUSE_GLCANVAS_EGL) if(TARGET OpenGL::EGL) - set(OPENGL_LIBRARIES OpenGL::EGL ${OPENGL_LIBRARIES}) + set(OPENGL_LIBRARIES OpenGL::EGL ${OPENGL_LIBRARIES} GL) endif() set(OPENGL_INCLUDE_DIR ${OPENGL_INCLUDE_DIR} ${OPENGL_EGL_INCLUDE_DIRS}) find_package(WAYLANDEGL)