@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})

@CONFIG_CODE@

set(iMSTK_ROOT ${PACKAGE_PREFIX_DIR})
set(iMSTK_DATA_DIR ${PACKAGE_PREFIX_DIR}/data)

# iMSTK settings
set(iMSTK_AUDIO_ENABLED @iMSTK_AUDIO_ENABLED@)
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@)
set(iMSTK_USE_VRPN @iMSTK_USE_VRPN@)
set(iMSTK_VTK_DEPENDENCIES "@iMSTK_VTK_DEPENDENCIES@")

# Save
set(_iMSTK_ORIG_CMAKE_DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
set(_iMSTK_ORIG_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})

set(CMAKE_DEBUG_POSTFIX @CMAKE_DEBUG_POSTFIX@)

# Use the iMSTK modules to find all required packages
list(APPEND CMAKE_MODULE_PATH
  "${CMAKE_CURRENT_LIST_DIR}/modules"
  "@iMSTK_SOURCE_DIR@/CMake"
  "@iMSTK_SOURCE_DIR@/CMake/Utilities"
  )

include(CMakeFindDependencyMacro)

# Assimp
find_dependency( Assimp )

# Eigen3
find_dependency( Eigen3 )

# FTD2XX
if(WIN32)
  find_dependency( FTD2XX )
endif()

# g3log
find_dependency( g3log )

# GTest
if(iMSTK_BUILD_TESTING)
  find_dependency( GTest CONFIG )
endif()

# LibNiFalcon
find_dependency( LibNiFalcon )

# Libusb
find_dependency( Libusb )

# OpenVR
find_dependency( OpenVR )

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

# SFML
if(iMSTK_AUDIO_ENABLED)
  find_dependency( SFML REQUIRED )
  add_definitions( -DiMSTK_AUDIO_ENABLED )
endif()

# TBB
find_dependency(TBB)

# VegaFEM
find_dependency( VegaFEM )

# VRPN
if (iMSTK_USE_VRPN)
  find_dependency( VRPN )
endif()

# OpenHaptics
if(iMSTK_USE_OpenHaptics)
  find_dependency( OpenHapticsSDK )
  add_definitions( -DiMSTK_USE_OPENHAPTICS )
endif()

# VTK
find_dependency(VTK CONFIG)
find_package(vtkRenderingOpenVR QUIET)
find_package(vtkRenderingExternal QUIET)
find_dependency(VTK COMPONENTS ${iMSTK_VTK_DEPENDENCIES})

if(iMSTK_USE_VTK_OSMESA)
  add_definitions(-DiMSTK_USE_VTK_OSMESA)
endif()

# Restore
set(CMAKE_DEBUG_POSTFIX ${_iMSTK_ORIG_CMAKE_DEBUG_POSTFIX})
set(CMAKE_MODULE_PATH ${_iMSTK_ORIG_CMAKE_MODULE_PATH})
