Skip to content

Instantly share code, notes, and snippets.

@candh
Created February 9, 2019 22:11
Show Gist options
  • Save candh/d2917113e1086b4f5a97cf99767d3480 to your computer and use it in GitHub Desktop.
Save candh/d2917113e1086b4f5a97cf99767d3480 to your computer and use it in GitHub Desktop.
CMakeList for OpenGL. Tested on macOS only. Seems Finicky
cmake_minimum_required(VERSION 3.6)
project(Testing C)
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
if (OPENGL_FOUND)
message("opengl found")
message("include dir: ${OPENGL_INCLUDE_DIR}")
message("link libraries: ${OPENGL_gl_LIBRARY}")
lse (OPENGL_FOUND)
message("opengl not found")
endif()
set(SOURCE_FILES main.c)
add_executable(test ${SOURCE_FILES})
include_directories(${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIRS})
# target_link_libraries(test ${OPENGL_glu_LIBRARY})
# target_link_libraries(test ${OPENGL_gl_LIBRARY})
target_link_libraries(test ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment