CMAKE_MINIMUM_REQUIRED (VERSION 2.6)

FIND_PACKAGE ( FreeType2 REQUIRED )

FILE( GLOB sources *.cpp )
IF( DESIRED_QT_VERSION EQUAL 3)
  INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
ELSEIF( DESIRED_QT_VERSION EQUAL 4 )
  INCLUDE_DIRECTORIES( ${QT_QTCORE_INCLUDE_DIR} )
  INCLUDE_DIRECTORIES( ${QT_QTGUI_INCLUDE_DIR} )
ENDIF( DESIRED_QT_VERSION EQUAL 3)

INCLUDE_DIRECTORIES(
  ${FREETYPE2_INCLUDE_DIR}
	)
INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR} )
CONFIGURE_FILE(
   "${CMAKE_CURRENT_SOURCE_DIR}/OGLFT.h.cmake"
   "${CMAKE_CURRENT_SOURCE_DIR}/OGLFT.h"
)

IF( WIN32 )
  ADD_DEFINITIONS( -DOGLFT_BUILD )
ENDIF( WIN32 )

ADD_LIBRARY( oglft SHARED ${sources} )
TARGET_LINK_LIBRARIES(
  oglft
  ${FREETYPE2_LIBRARIES}
  ${OPENGL_LIBRARIES}
 )

INSTALL(
  TARGETS oglft
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  COMPONENT libraries
)

INSTALL(
  FILES "${CMAKE_CURRENT_SOURCE_DIR}/OGLFT.h"
  DESTINATION include/OGLFT
    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
  COMPONENT headers
)
