if(WITH_QT)
    if(WITH_QT4)
        find_package(Qt4 )
        if(Qt4_FOUND)
            set(QT4_LIBRARIES "${QT_LIBRARIES}")
            set(QT4_INCLUDE_DIRS "${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}/QtOpenGL")
            set(HAVE_QT4 TRUE)
        else()
            message(FATAL_ERROR "Could not find Qt4 libraries! You should install the libraries or turn off Qt completely by disabling WITH_QT")
        endif()
    else()
        find_package(Qt5 REQUIRED Core OpenGL Widgets)
        if(Qt5Core_FOUND)
            set(HAVE_QT TRUE)
            set(HAVE_QT_OPENGL TRUE)
            set(HAVE_QT5 TRUE)

        else()
            message(FATAL_ERROR "Could not find Qt5 libraries! Either install the libraries, or enable WITH_QT4 instead, or turn off Qt completely by disabling WITH_QT")
        endif()

    endif()
endif()

