MACRO(ADD_QT_DEPENDENCY)
  IF(PROJECT_USE_QT4)
    ADD_PROJECT_DEPENDENCY(Qt4 REQUIRED QtCore QtGui QtOpenGL QtNetwork QtXml)
    SET(PROJECT_QT_LIBS Qt4::QtCore Qt4::QtGui Qt4::QtOpenGL Qt4::QtNetwork Qt4::QtXml)
    SET(GEPETTO_VIEWER_QTVERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
    INCLUDE(${QT_USE_FILE})
    SET(PACKAGE_EXTRA_MACROS "include(${QT_USE_FILE})\n${PACKAGE_EXTRA_MACROS}")
  ELSE()
    ADD_PROJECT_DEPENDENCY(Qt5 REQUIRED COMPONENTS Xml Core Widgets Gui OpenGL Network Concurrent)
    FOREACH (component "Xml" "Core" "Widgets" "Gui" "OpenGL" "Network" "Concurrent")
      LIST(APPEND PROJECT_QT_LIBS Qt5::${component})
    ENDFOREACH ()
    SET(GEPETTO_VIEWER_QTVERSION "${Qt5Core_VERSION}")
  ENDIF()
  SET(PKG_CONFIG_EXTRA "qtversion=${GEPETTO_VIEWER_QTVERSION}\n${PKG_CONFIG_EXTRA}")
  SET(PACKAGE_EXTRA_MACROS "set(GEPETTO_VIEWER_QTVERSION ${GEPETTO_VIEWER_QTVERSION})\n${PACKAGE_EXTRA_MACROS}")

  SET(CMAKE_INCLUDE_CURRENT_DIR ON)
  SET(CMAKE_AUTOMOC ON)
  SET(CMAKE_AUTOUIC ON)
ENDMACRO(ADD_QT_DEPENDENCY)
