set(oif_SRCS
    continuousgesturearea.cpp
    device.cpp
    geissingleton.cpp
    gesture.cpp
    gesturearea.cpp
    gestureevent.cpp
    instantaneousgesturearea.cpp
    touch.cpp
    oif_plugin.cpp
    oifdragarea.cpp
    oifpincharea.cpp
    oifrotatearea.cpp
    oiftaparea.cpp
    )

set(oif_HDRS
    continuousgesturearea.h
    device.h
    geissingleton.h
    gesture.h
    gesturearea.h
    gestureevent.h
    instantaneousgesturearea.h
    touch.h
    oif_plugin.h
    oifdragarea.h
    oifpincharea.h
    oifrotatearea.h
    oiftaparea.h
    )

qt4_wrap_cpp(oif_MOC_SRCS ${oif_HDRS})

add_library(oif MODULE ${oif_SRCS} ${oif_MOC_SRCS})

target_link_libraries(oif ${GEIS_LDFLAGS})

set(PLUGIN_INSTALL_DIR lib/qt4/imports/oif)

install(TARGETS oif DESTINATION ${PLUGIN_INSTALL_DIR})

install(FILES qmldir DESTINATION ${PLUGIN_INSTALL_DIR})

# Documentation target
if (DOXYGEN_FOUND)
    configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in
        ${CMAKE_BINARY_DIR}/Doxyfile @ONLY)

    add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/html
    COMMAND ${DOXYGEN_EXECUTABLE}
    DEPENDS ${oif_SRCS} ${oif_HDRS} ${CMAKE_BINARY_DIR}/Doxyfile
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
    COMMENT "Generating API documentation with Doxygen" VERBATIM)

    add_custom_target(doc ALL DEPENDS ${CMAKE_BINARY_DIR}/html)

    install(DIRECTORY ${CMAKE_BINARY_DIR}/html DESTINATION "share/doc/oif-qml")
    install(FILES ${CMAKE_BINARY_DIR}/qch/oif-qml.qch DESTINATION "share/qt4/doc/qch")
endif (DOXYGEN_FOUND)
