FIND_PACKAGE( GLUT )

LINK_LIBRARIES( oglft ${FREETYPE2_LIBRARIES})

INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
INCLUDE_DIRECTORIES( ${FREETYPE2_INCLUDE_DIR}
	${FREETYPE2_INCLUDE_DIR}/freetype2
	)
INCLUDE_DIRECTORIES( ${GLUT_INCLUDE_DIR} )
IF( ENABLE_QT )
IF( DESIRED_QT_VERSION EQUAL 3)
  INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
  LINK_LIBRARIES( oglft ${FREETYPE2_LIBRARIES} ${QT_LIBRARIES} )
ELSEIF( DESIRED_QT_VERSION EQUAL 4 )
  INCLUDE_DIRECTORIES( ${QT_QTCORE_INCLUDE_DIR} )
  INCLUDE_DIRECTORIES( ${QT_QTGUI_INCLUDE_DIR} )
  INCLUDE_DIRECTORIES( ${QT_QTOPENGL_INCLUDE_DIR} )
  LINK_LIBRARIES( oglft ${FREETYPE2_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} )
ENDIF( DESIRED_QT_VERSION EQUAL 3)
ENDIF( ENABLE_QT )

ADD_EXECUTABLE( 
  tutorial1
  tutorial1.cpp 
)

TARGET_LINK_LIBRARIES(
  tutorial1
  ${GLUT_LIBRARIES}
)

ADD_EXECUTABLE( 
  tutorial2
  tutorial2.cpp 
)

TARGET_LINK_LIBRARIES(
  tutorial2
  ${GLUT_LIBRARIES}
)

ADD_EXECUTABLE( 
  tutorial3
  tutorial3.cpp 
)

TARGET_LINK_LIBRARIES(
  tutorial3
  ${GLUT_LIBRARIES}
)

ADD_EXECUTABLE( 
  tutorial3
  tutorial3.cpp 
)

TARGET_LINK_LIBRARIES(
  tutorial3
  ${GLUT_LIBRARIES}
)

ADD_EXECUTABLE( 
  demo
  demo.cpp 
)

TARGET_LINK_LIBRARIES(
  demo
  ${GLUT_LIBRARIES}
)

ADD_EXECUTABLE( 
  demo2
  demo2.cpp 
)

TARGET_LINK_LIBRARIES(
  demo2
  ${GLUT_LIBRARIES}
)

IF( ENABLE_QT )
IF( DESIRED_QT_VERSION EQUAL 3 )
KDE3_AUTOMOC( demo3.cpp speedtest.cpp )
ELSEIF( DESIRED_QT_VERSION EQUAL 4 )
QT4_AUTOMOC( demo3.cpp speedtest.cpp )
ENDIF( DESIRED_QT_VERSION EQUAL 3 )
ADD_EXECUTABLE( 
  demo3
  demo3.cpp 
)

TARGET_LINK_LIBRARIES(
  demo3
  ${OPENGL_LIBRARIES}
)

ADD_EXECUTABLE( 
  speedtest
  speedtest.cpp 
)

TARGET_LINK_LIBRARIES(
  speedtest
  ${OPENGL_LIBRARIES}
)
ENDIF( ENABLE_QT )

# Copy some files needed by demo3 into the tests directory.
FILE( GLOB images *.png )
FOREACH( test_png ${images} )
  GET_FILENAME_COMPONENT( png_file ${test_png} NAME )
  CONFIGURE_FILE( ${test_png}
  "${CMAKE_CURRENT_BINARY_DIR}/${png_file}" COPYONLY )
ENDFOREACH( test_png ${images} )
