Skip to content

Instantly share code, notes, and snippets.

@icedraco
Created January 10, 2016 20:35
Show Gist options
  • Save icedraco/3ae34b1917cd4e036b54 to your computer and use it in GitHub Desktop.
Save icedraco/3ae34b1917cd4e036b54 to your computer and use it in GitHub Desktop.
Example cmake configuration file for working with OpenGL on JetBrains CLion
# NOTE: IF THIS FAILS, YOU MAY HAVE TO
# sudo apt-get install libxmu-dev libxi-dev
# http://ubuntuforums.org/showthread.php?t=1703770
cmake_minimum_required(VERSION 3.3)
project(ass4)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#--- Find GLUT
find_package(GLUT REQUIRED)
include_directories(${GLUT_INCLUDE_DIRS})
link_directories(${GLUT_LIBRARY_DIRS})
add_definitions(${GLUT_DEFINITIONS})
if(NOT GLUT_FOUND)
message(ERROR " GLUT not found!")
endif(NOT GLUT_FOUND)
#--- Find OpenGL
find_package(OpenGL REQUIRED)
include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})
if(NOT OPENGL_FOUND)
message(ERROR " OPENGL not found!")
endif(NOT OPENGL_FOUND)
#--- GL includes
include_directories(
"/usr/include/GL"
)
#--- Source files
set(SOURCE_FILES
ColorProperties.h
ColorTable.h
ColorTableParser.cpp
ColorTableParser.h
Face.h
Group.h
main.cpp
Object.cpp
Object.h
ObjectPainter.cpp
ObjectPainter.h
ObjExporter.cpp
ObjExporter.h
ObjParser.cpp
ObjParser.h
PaintCommand.cpp
PaintCommand.h
Point.h
RgbColor.h
Side.h
Vector.h
Vector3f.h
Vertex.h)
add_executable(ass4 ${SOURCE_FILES})
target_link_libraries(ass4 ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment