Skip to content

Instantly share code, notes, and snippets.

@dogukanarat
Created May 18, 2024 11:07
Show Gist options
  • Save dogukanarat/2e0fb90d1c2c57fb5d95eb0b864dd589 to your computer and use it in GitHub Desktop.
Save dogukanarat/2e0fb90d1c2c57fb5d95eb0b864dd589 to your computer and use it in GitHub Desktop.
FindOpenGL cmake module
# FindOpenGL - Find OpenGL library
# This module finds if OpenGL is installed and determines where the include
# files and libraries are.
# This module defines the following variables:
# OPENGL_FOUND - True if OpenGL found
# OPENGL_INCLUDE_DIR - where to find gl.h, etc.
# OPENGL_LIBRARY - the name of the OpenGL library
find_library(
OPENGL_LIBRARY
NAMES GL
PATHS
/opt/homebrew
/usr/local/lib
/usr/lib
/usr/local/lib64
/usr/lib64
/opt/local/lib
)
find_path(
OPENGL_INCLUDE_DIR
NAMES GL/gl.h
PATHS
/opt/homebrew
/usr/include
/usr/local/include
/opt/local/include
)
if(OPENGL_LIBRARY AND OPENGL_INCLUDE_DIR)
set(OPENGL_FOUND TRUE)
message(STATUS "Found OpenGL: ${OPENGL_LIBRARY} ${OPENGL_INCLUDE_DIR}")
else()
set(OPENGL_FOUND FALSE)
message(STATUS "OpenGL not found")
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment