include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_BINARY_DIR}
  ${CMAKE_SOURCE_DIR}/k9Mplayer
  ${CMAKE_SOURCE_DIR}/k9author
  ${CMAKE_SOURCE_DIR}/k9decmpeg
  ${CMAKE_SOURCE_DIR}/k9devices
  ${CMAKE_SOURCE_DIR}/k9vamps
  ${CMAKE_SOURCE_DIR}/libdvdnav
  ${CMAKE_SOURCE_DIR}/libk9copy
  ${TDE_INCLUDE_DIR}
)

link_directories(
  ${TDE_LIB_DIR}
  ${LIBAVCODEC_LIBRARY_DIRS}
  ${LIBAVFORMAT_LIBRARY_DIRS}
  ${LIBAVUTIL_LIBRARY_DIRS}
  ${LIBSWSCALE_LIBRARY_DIRS}
)

##### k9copy (executable)
file( GLOB _lib_cpp_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp )
file( GLOB _lib_ui_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.ui )

tde_add_executable( k9copy AUTOMOC
  SOURCES ${_lib_cpp_files} ${_lib_ui_files}
  LINK
    k9mplayer-static k9author-static k9decmpeg-static k9devices-static
    k9vamps-static k9dvdnav-static k9copy-static
    tdecore-shared tdefx-shared tdeui-shared tdeio-shared tdehtml-shared
    tdetexteditor-shared tdeparts-shared tdemdi-shared DCOP-shared
    ${LIBAVCODEC_LIBRARIES} ${LIBAVFORMAT_LIBRARIES} ${LIBAVUTIL_LIBRARIES}
    ${LIBSWSCALE_LIBRARIES} ${LIBDVDREAD_LIBRARIES} ${K3BDEVICE_LIBRARY}
  DESTINATION ${BIN_INSTALL_DIR}
)


##### app icon

tde_install_icons( ${PROJECT_NAME} )


##### other files

install(
  FILES anim.mng k9copyui.rc mencoder.xml
  DESTINATION ${DATA_INSTALL_DIR}/k9copy
)

tde_create_translated_desktop(
  SOURCE k9copy_open.desktop
  DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus
)

tde_create_translated_desktop(
  SOURCE k9copy.desktop
  DESTINATION ${XDG_APPS_INSTALL_DIR}
)