set(OPENGL_INCLUDE_DIR         "" CACHE PATH "" FORCE)
set(OPENGL_xmesa_INCLUDE_DIR   "" CACHE PATH "" FORCE)
set(OPENGL_gl_LIBRARY          "" CACHE FILEPATH "" FORCE)
set(OPENGL_glu_LIBRARY         "" CACHE FILEPATH "" FORCE)
find_path(OSMESA_INCLUDE_DIR GL/osmesa.h)
find_library(OSMESA_LIBRARY  OSMesa)

add_extra_cmake_args(
  -DOPENGL_INCLUDE_DIR:PATH=${OPENGL_INCLUDE_DIR}
  -DOPENGL_xmesa_INCLUDE_DIR:PATH=${OPENGL_xmesa_INCLUDE_DIR}
  -DOPENGL_gl_LIBRARY:FILEPATH=${OPENGL_gl_LIBRARY}
  -DOPENGL_glu_LIBRARY:FILEPATH=${OPENGL_glu_LIBRARY}
  -DOSMESA_INCLUDE_DIR:PATH=${OSMESA_INCLUDE_DIR}
  -DOSMESA_LIBRARY:FILEPATH=${OSMESA_LIBRARY}
)
