find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets OpenGL QUIET)

if (Qt${QT_VERSION_MAJOR}Widgets_FOUND)
  project(QtRenderAreaGuiIntegration)

  #Ask CMake to automoc needed includes
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)

  # Cause we need to find RenderArea.h
  include_directories(../..)


  link_libraries( "${VolumeViz_LIBRARIES}" )
  
  qt_add_resources( ${PROJECT_NAME}_ico  ${resource_files} )
  qt_wrap_ui( ${PROJECT_NAME}_headers MainWindow.ui )

  set(header_files
    MainWindow.h
  )

  set(resource_files
    icons.qrc
  )

  add_oiv_qt_executable(${PROJECT_NAME}
    main.cxx
    MainWindow.cxx
    ${header_files}

	#These will be auto mocced
    ${${PROJECT_NAME}_ico}
	${${PROJECT_NAME}_headers}
  )

  target_link_libraries(${PROJECT_NAME}
    ${OpenInventorViewerComponents_LIBRARIES}
    ${OpenInventorQtViewerComponents_LIBRARIES}
    Qt::Widgets Qt::OpenGL
  )

  target_link_libraries(${PROJECT_NAME} ${IvTune_LIBRARIES})

  source_group("Resources Files" FILES ${resource_files})

endif()
