Skip to content

Commit

Permalink
Fix usage of find_package(OpenGL) on Linux (libigl#1733)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdumas authored Feb 28, 2021
1 parent e60423e commit 9f2ae30
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cmake/libigl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,11 @@ if(LIBIGL_WITH_OPENGL)
if (NOT CMAKE_VERSION VERSION_LESS "3.11")
cmake_policy(SET CMP0072 NEW)
endif()
find_package(OpenGL REQUIRED)
if(TARGET OpenGL::GL)
target_link_libraries(igl_opengl ${IGL_SCOPE} OpenGL::GL)
find_package(OpenGL REQUIRED OPTIONAL_COMPONENTS OpenGL)
if(TARGET OpenGL::OpenGL)
target_link_libraries(igl_opengl ${IGL_SCOPE} OpenGL::OpenGL)
else()
target_link_libraries(igl_opengl ${IGL_SCOPE} ${OPENGL_gl_LIBRARY})
target_include_directories(igl_opengl SYSTEM ${IGL_SCOPE} ${OPENGL_INCLUDE_DIR})
target_link_libraries(igl_opengl ${IGL_SCOPE} OpenGL::GL)
endif()

# glad module
Expand Down

0 comments on commit 9f2ae30

Please sign in to comment.