[CMake] Compiling OpenGL application with CMake

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Feb 25 11:16:58 EST 2009


On Fri, Feb 20, 2009 at 2:36 AM, Andrea Tagliasacchi <ata2 at cs.sfu.ca> wrote:
> Thanks Philip,
>
> that worked flawlessly!
>
> I would say that this is the most compact CMake specification to compile
> a Glut/OpenGL application then:
>
> find_package(GLUT)
> find_package(OpenGL)
> INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
> ADD_EXECUTABLE(mesh_view mesh_view.cpp)
> TARGET_LINK_LIBRARIES(mesh_view ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})

Indeed that's the idea. But in this particular case you cannot assume
glut and opengl are in the same location. So you should do both
include_directories:

INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${GLUT_INCLUDE_DIR})

2cts
-- 
Mathieu


More information about the CMake mailing list