[CMake] Using target_link_libraries

Colin Michael Diesh diesh at colorado.edu
Sat Mar 27 21:25:15 EDT 2010


No, I just renamed it in the posting wrong. Here's how it looks actually

CMakeLists.txt -- something like this
---------------------------
PROJECT(tiney)

FIND_PACKAGE(OpenGL)
FIND_PACKAGE(GLUT)
FIND_PACKAGE(GLEW)

...
IF(GLEW_FOUND)
   SET(tiney_LIBS ${tiney_LIBS} ${GLEW_LIBRARY} )
ENDIF(GLEW_FOUND)

IF(OPENGL_FOUND)
   SET(tiney_LIBS ${tiney_LIBS} ${OPENGL_LIBRARIES} )
ENDIF(OPENGL_FOUND)

IF(GLUT_FOUND)
   SET(tiney_LIBS ${tiney_LIBS} ${GLUT_LIBRARIES} )
ENDIF(GLUT_FOUND)
...

ADD_EXECUTABLE(tiney ${tiney_SRCS})
TARGET_LINK_LIBRARIES(tiney ${tiney_LIBS})
-----------------------

-Colin


More information about the CMake mailing list