Fixes OpenGL build on FreeBSD.
@@ -14,12 +14,27 @@ endif()
ADD_DEFINITIONS(-DGLEW_STATIC)
add_library(oglGraph STATIC ${oglGraph_src_files})
-target_include_directories(oglGraph PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+set(OpenGL_GL_PREFERENCE GLVND)
+find_package(OpenGL REQUIRED)
+if(NOT TARGET OpenGL::GL)
+ message(FATAL_ERROR "OpenGL/GL not found!")
+endif(NOT TARGET OpenGL::GL)
+if(NOT TARGET OpenGL::GLU)
+ message(FATAL_ERROR "OpenGL/GLU not found!")
+endif(NOT TARGET OpenGL::GLU)
+message(STATUS "OPENGL_INCLUDE_DIR: ${OPENGL_INCLUDE_DIR}")
+message(STATUS "OPENGL_LIBRARIES: ${OPENGL_LIBRARIES}")
+
+target_include_directories(oglGraph PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${OPENGL_INCLUDE_DIR}
+)
if (APPLE)
set(GL_LIBS "-framework OpenGL" "-framework GLUT")
elseif (UNIX)
- set(GL_LIBS GL)
+ set(GL_LIBS ${OPENGL_LIBRARIES})
endif()
if(UNIX)
