cmake_minimum_required(VERSION 2.4)

## INCLUDE( /usr/lib/IGSTK/IGSTKConfig.cmake )
## INCLUDE( /usr/lib/IGSTK/UseIGSTK.cmake )

#
# Find IGSTK
#
FIND_PACKAGE(IGSTK REQUIRED)
IF(IGSTK_FOUND)
  INCLUDE(${IGSTK_USE_FILE})
ENDIF(IGSTK_FOUND)
#  MESSAGE( FATAL_ERROR "This application requires IGSTK. One of these components is missing. Please verify configuration")
#ENDIF (IGSTK_FOUND)


#
# FIND ITK
#
FIND_PACKAGE(ITK REQUIRED)
IF (ITK_FOUND)
  INCLUDE (${USE_ITK_FILE})
ELSE (ITK_FOUND)
  MESSAGE( FATAL_ERROR "This application requires ITK. One of these components is missing. Please verify configuration")
ENDIF (ITK_FOUND)


#
# FIND VTK
#
FIND_PACKAGE(VTK REQUIRED)
IF (VTK_FOUND)
  INCLUDE (${USE_VTK_FILE})
ELSE (VTK_FOUND)
  MESSAGE( FATAL_ERROR "This application requires VTK. One of these components is missing. Please verify configuration")
ENDIF (VTK_FOUND)


#
# FIND FLTK
#
FIND_PACKAGE(FLTK)
  IF (FLTK_FOUND)
    INCLUDE_DIRECTORIES (${FLTK_INCLUDE_DIR})
    IF(WIN32)
      ADD_DEFINITIONS(-DWIN32)
    ENDIF(WIN32)
    LINK_LIBRARIES( ${FLTK_LIBRARIES} ${OPENGL_LIBRARIES} )
    IF(CYGWIN)
      LINK_LIBRARIES( ole32 uuid comctl32 wsock32 supc++ -lm -lgdi32)
    ENDIF(CYGWIN)
  ELSE (FLTK_FOUND)
    MESSAGE( FATAL_ERROR "This application requires FLTK. One of these components is missing. Please verify configuration")
  ENDIF (FLTK_FOUND)

#
# Examples that do not require GUI
#

SUBDIRS(
 TransformReaders
 TransformWriters
 TrackerConfiguration
 Tools
 TrackerDataLogger
)



#
# Examples that require FLTK
#
IF(IGSTK_USE_FLTK)
  SUBDIRS(
    HelloWorld
    OneViewAndTracking
    FourViewsAndTracking
    TrackingVolumeViewer 
    NeedleBiopsy
    Navigator
    PivotCalibrationFLTKWidget
   )

   IF(IGSTK_USE_MicronTracker)
     SUBDIRS(OneViewAndTrackingUsingMicronTracker)
   ENDIF(IGSTK_USE_MicronTracker)
ENDIF(IGSTK_USE_FLTK)

IF(IGSTK_USE_Qt)
   IF(IGSTK_USE_MicronTracker)
     SUBDIRS(OneViewAndTrackingUsingQTWidgetAndMicronTracker)
   ENDIF(IGSTK_USE_MicronTracker)
ENDIF(IGSTK_USE_Qt)

IF (IGSTK_USE_OpenIGTLink)
    SUBDIRS(  OpenIGTLinkTrackerBroadcasting )
    SUBDIRS(  OpenIGTLinkConfigurationReaders )
ENDIF (IGSTK_USE_OpenIGTLink)


IF(IGSTK_USE_VideoImager)
 IF( WIN32 )
   IF (IGSTK_USE_OpenCV)
      SUBDIRS( VideoFrameGrabberAndViewerWebcam )
   ENDIF (IGSTK_USE_OpenCV)
 ENDIF( WIN32 )

 IF(IGSTK_USE_OpenIGTLink)
  SUBDIRS( VideoFrameGrabberAndViewerOpenIGTLink )
 ENDIF(IGSTK_USE_OpenIGTLink)

ENDIF(IGSTK_USE_VideoImager)
 


