Skip to content

Commit

Permalink
use found OpenGL libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
LiangliangNan committed Feb 4, 2024
1 parent e731b10 commit d408bf1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions 3rd_party/glew/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ file(STRINGS ${GLEW_DIR}/config/version _VERSION_PATCH_STRING REGEX "GLEW_MICRO[
string(REGEX REPLACE "GLEW_MICRO[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${_VERSION_PATCH_STRING})
set(GLEW_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})

if(WIN32 OR MSVC OR APPLE)
find_package(OpenGL COMPONENTS OpenGL REQUIRED)
message(STATUS "OpenGL library: ${OPENGL_gl_LIBRARY}")
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
# prefer GLVND
if (OPENGL_opengl_LIBRARY)
set(GLEW_LIBRARIES ${OPENGL_opengl_LIBRARY})
else ()
set(GLEW_LIBRARIES ${OPENGL_gl_LIBRARY})
else() # == if(UNIX AND NOT APPLE)
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL COMPONENTS OpenGL GLX REQUIRED)
message(STATUS "OpenGL libraries: ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY}")
set(GLEW_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY})
endif()
endif ()
if (OPENGL_glx_LIBRARY)
list(APPEND GLEW_LIBRARIES ${OPENGL_glx_LIBRARY})
endif ()
message(STATUS "OpenGL libraries: ${GLEW_LIBRARIES}")

# cmake<3.10 doesn't detect EGL/GLX
if (CMAKE_VERSION VERSION_LESS 3.10)
Expand Down

0 comments on commit d408bf1

Please sign in to comment.