ASITUS_THIRDPARTY_PRODUCT("vtk" "" "vtkAlgorithm.h" "vtkCommonCore-8.0")

if (3RDPARTY_vtk_INCLUDE_DIR STREQUAL "")
  message (STATUS "... VTK Include dir is not conventional")
  list (REMOVE_ITEM 3RDPARTY_NOT_INCLUDED 3RDPARTY_vtk_INCLUDE_DIR)
  set (3RDPARTY_vtk_INCLUDE_DIR ${3RDPARTY_vtk_DIR}/include/vtk-8.0 CACHE FILEPATH "Non-conventional inc dir" FORCE)
endif()

message (STATUS "... VTK Include dirs: ${3RDPARTY_vtk_INCLUDE_DIR}")
message (STATUS "... VTK Library dirs: ${3RDPARTY_vtk_LIBRARY_DIR}")
message (STATUS "... VTK Binary  dirs: ${3RDPARTY_vtk_DLL_DIR}")

string (REPLACE lib libd 3RDPARTY_vtk_LIBRARY_DIR_DEBUG ${3RDPARTY_vtk_LIBRARY_DIR})
if (3RDPARTY_vtk_LIBRARY_DIR_DEBUG AND EXISTS "${3RDPARTY_vtk_LIBRARY_DIR_DEBUG}")
  if (WIN32)
    if (NOT EXISTS "${3RDPARTY_vtk_LIBRARY_DIR_DEBUG}/vtkCommonCore-8.0.lib")
      set (3RDPARTY_vtk_LIBRARY_DIR_DEBUG "" CACHE INTERNAL FORCE)
    endif()
  else()
    if (NOT EXISTS "${3RDPARTY_vtk_LIBRARY_DIR_DEBUG}/libvtkCommonCore-8.0.so")
      set (3RDPARTY_vtk_LIBRARY_DIR_DEBUG "" CACHE INTERNAL FORCE)
    endif()
  endif()
endif()

if (WIN32)
  string (REPLACE bin bind 3RDPARTY_vtk_DLL_DIR_DEBUG ${3RDPARTY_vtk_DLL_DIR})
  if (3RDPARTY_vtk_DLL_DIR_DEBUG AND EXISTS "${3RDPARTY_vtk_DLL_DIR_DEBUG}")
    if (NOT EXISTS "${3RDPARTY_vtk_DLL_DIR_DEBUG}/vtkCommonCore-8.0.dll")
      set (3RDPARTY_vtk_DLL_DIR_DEBUG "" CACHE INTERNAL FORCE)
    endif()
  endif()
endif()

message (STATUS "... VTK Debug Library dirs: ${3RDPARTY_vtk_LIBRARY_DIR_DEBUG}")
message (STATUS "... VTK Debug Binary  dirs: ${3RDPARTY_vtk_DLL_DIR_DEBUG}")

#--------------------------------------------------------------------------
# Installation
if (WIN32)

  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkalglib-8.0.dll                      DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkChartsCore-8.0.dll                  DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonComputationalGeometry-8.0.dll DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonColor-8.0.dll                 DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonCore-8.0.dll                  DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonDataModel-8.0.dll             DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonExecutionModel-8.0.dll        DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonMath-8.0.dll                  DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonMisc-8.0.dll                  DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonSystem-8.0.dll                DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkCommonTransforms-8.0.dll            DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersCore-8.0.dll                 DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersExtraction-8.0.dll           DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersGeneral-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersGeometry-8.0.dll             DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersHybrid-8.0.dll               DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersImaging-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersModeling-8.0.dll             DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersParallel-8.0.dll             DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersSources-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkFiltersStatistics-8.0.dll           DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkfreetype-8.0.dll                    DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkGUISupportQt-8.0.dll                DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkglew-8.0.dll                        DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkImagingColor-8.0.dll                DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkImagingCore-8.0.dll                 DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkImagingFourier-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkImagingGeneral-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkImagingHybrid-8.0.dll               DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkImagingSources-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkInteractionWidgets-8.0.dll          DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkInteractionStyle-8.0.dll            DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkInfovisCore-8.0.dll                 DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkInfovisLayout-8.0.dll               DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkIOCore-8.0.dll                      DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkIOImage-8.0.dll                     DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkIOLegacy-8.0.dll                    DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkIOExport-8.0.dll                    DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkIOExportOpenGL2-8.0.dll             DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkParallelCore-8.0.dll                DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingAnnotation-8.0.dll         DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingContext2D-8.0.dll          DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingContextOpenGL2-8.0.dll     DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingCore-8.0.dll               DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingGL2PSOpenGL2-8.0.dll       DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingFreeType-8.0.dll           DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingLabel-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingOpenGL2-8.0.dll            DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkRenderingVolume-8.0.dll             DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtksys-8.0.dll                         DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkViewsContext2D-8.0.dll              DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkViewsCore-8.0.dll                   DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkViewsInfovis-8.0.dll                DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkzlib-8.0.dll                        DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtklz4-8.0.dll                         DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkgl2ps-8.0.dll                       DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkpng-8.0.dll                         DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtklibharu-8.0.dll                     DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkDICOMParser-8.0.dll                 DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkmetaio-8.0.dll                      DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtktiff-8.0.dll                        DESTINATION bin)
  install (FILES ${3RDPARTY_vtk_DLL_DIR}/vtkjpeg-8.0.dll                        DESTINATION bin)

endif()
