@PACKAGE_INIT@

set(export_config_name "@export_config_name@")

set_and_check(${export_config_name}Targets "${CMAKE_CURRENT_LIST_DIR}/${export_config_name}Targets.cmake")

include(${${export_config_name}Targets})
include(CMakeFindDependencyMacro)

# iMSTK settings
set(iMSTK_ROOT ${PACKAGE_PREFIX_DIR})
set(iMSTK_DATA_DIR ${PACKAGE_PREFIX_DIR}/data)
set(iMSTK_USE_OpenHaptics @iMSTK_USE_OpenHaptics@)
set(iMSTK_USE_VTK_OSMESA @iMSTK_USE_VTK_OSMESA@)
set(iMSTK_BUILD_TESTING @iMSTK_BUILD_TESTING@)
set(iMSTK_USE_PHYSX @iMSTK_USE_PHYSX@)

# Use the iMSTK modules to find all required packages
set(CACHE_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
include(${CMAKE_CURRENT_LIST_DIR}/modules/imstkFind.cmake)
include(CMakeFindDependencyMacro)
set(CMAKE_DEBUG_POSTFIX @CMAKE_DEBUG_POSTFIX@)

# Assimp
find_package( Assimp REQUIRED )

# Eigen3
set(Eigen3_DIR "@Eigen3_DIR@")
find_dependency( Eigen3 REQUIRED )

# FTD2XX
if(WIN32)
  find_package( FTD2XX REQUIRED )
endif()

# g3log
find_package( g3log REQUIRED )

# GTest
if(iMSTK_BUILD_TESTING)
  set(GTest_DIR "@GTest_DIR@")
  find_dependency( GTest REQUIRED NO_DEFAULT_PATH )
endif()

# LibNiFalcon
find_package( LibNiFalcon REQUIRED)

# Libusb
find_package( Libusb REQUIRED)

# OpenVR
find_package( openvr REQUIRED )

# PhysX
if (iMSTK_USE_PHYSX)
  find_package(PhysX REQUIRED)
endif()

# SFML
if(WIN32)
  find_package( SFML REQUIRED )
  add_definitions( -DiMSTK_AUDIO_ENABLED )
endif()

# tbb
find_package(tbb REQUIRED)
if (MSVC)
  add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE=1)
endif()

# VegaFEM
set(VegaFEM_DIR "@VegaFEM_DIR@")
find_dependency( VegaFEM REQUIRED CONFIG )

# VRPN
if (iMSTK_USE_VRPN)
  find_package( VRPN REQUIRED )
endif()

# OpenHaptics
if(iMSTK_USE_OpenHaptics)
  find_package( OpenHapticsSDK REQUIRED )
  add_definitions( -DiMSTK_USE_OPENHAPTICS )
endif()

# VTK
list(GET OPENVR_INCLUDE_DIRS 0 OpenVR_INCLUDE_DIR)
list(GET OPENVR_LIBRARIES 1 OpenVR_LIBRARY)
set(OpenVR_INCLUDE_DIR ${OpenVR_INCLUDE_DIR} CACHE INTERNAL "")
set(OpenVR_LIBRARY ${OpenVR_LIBRARY} CACHE INTERNAL "")
set(VTK_DIR "@VTK_DIR@")
find_dependency(VTK CONFIG)
# modules are linked via `VTK::CommonCore`
# vtk_module_autoinit is needed
find_dependency(VTK COMPONENTS
  ChartsCore
  CommonCore
  CommonDataModel
  FiltersCore
  FiltersExtraction
  FiltersGeneral
  FiltersModeling
  FiltersSources
  IOExport
  IOImport
  IOPLY
  IOParallel
  IOParallelXML
  ImagingCore
  ImagingGeneral
  ImagingStencil
  InteractionStyle
  RenderingAnnotation
  RenderingContext2D
  RenderingContextOpenGL2
  RenderingCore
  RenderingOpenGL2
  RenderingOpenVR
  RenderingVolume
  RenderingVolumeOpenGL2
  ViewsContext2D)
find_dependency(VTK COMPONENTS ${VTK_DEPENDENCIES})
if(iMSTK_USE_VTK_OSMESA)
  add_definitions(-DiMSTK_USE_VTK_OSMESA)
endif()
set(CMAKE_MODULE_PATH ${CACHE_CMAKE_MODULE_PATH})