
include_directories(
  ${CMAKE_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${TDE_INCLUDE_DIR}
  ${TQT_INCLUDE_DIRS}
)

link_directories(
  ${TQT_LIBRARY_DIRS}
  ${TDE_LIB_DIR}
)

tde_import( kate )

add_custom_command(
    OUTPUT  dotparse.cpp dotparse.hpp
    COMMAND ${BISON_EXECUTABLE}
    ARGS -y --output dotparse.cpp --defines=dotparse.hpp ${CMAKE_CURRENT_SOURCE_DIR}/dotparse.ypp
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dotparse.ypp
)

add_custom_target(
    dotparse.bison
    DEPENDS
        ${CMAKE_CURRENT_BINARY_DIR}/dotparse.cpp
        ${CMAKE_CURRENT_BINARY_DIR}/dotparse.hpp
)

add_custom_command(
    OUTPUT  dotscan.cpp
    COMMAND ${FLEX_EXECUTABLE}
    ARGS ${CMAKE_CURRENT_SOURCE_DIR}/dotscan.lpp
    COMMAND ${CMAKE_COMMAND}
    ARGS -E rename lex.yy.c dotscan.cpp
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dotscan.lpp
)

add_custom_target(
    dotscan.lex
    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dotscan.cpp
)

##### kscope (executable)

tde_add_executable( kscope AUTOMOC

  SOURCES
        autocompletionlayout.ui bookmarkslayout.ui
        calltreelayout.ui cscopemsglayout.ui
        fileviewlayout.ui graphpreflayout.ui
        makelayout.ui newprojectlayout.ui
        openprojectlayout.ui prefcolorlayout.ui
        preffontlayout.ui preffrontendlayout.ui
        prefoptlayout.ui projectfileslayout.ui
        queryviewlayout.ui querywidgetlayout.ui
        scanprogresslayout.ui searchresultslayout.ui
        symbollayout.ui welcomedlg.ui
        bookmarksdlg.cpp calltreedlg.cpp
        calltreemanager.cpp configfrontend.cpp
        cscopefrontend.cpp cscopemsgdlg.cpp
        ctagsfrontend.cpp ctagslist.cpp
        dirscanner.cpp dotfrontend.cpp
        editormanager.cpp
        editorpage.cpp editortabs.cpp
        encoder.cpp filelist.cpp
        fileview.cpp frontend.cpp
        graphedge.cpp graphnode.cpp
        graphprefdlg.cpp graphwidget.cpp
        historypage.cpp historyview.cpp
        kscope.cpp kscopeactions.cpp
        kscopeconfig.cpp kscopepixmaps.cpp
        main.cpp makedlg.cpp makefrontend.cpp
        newprojectdlg.cpp openprojectdlg.cpp
        prefcolor.cpp preferencesdlg.cpp
        preffont.cpp preffrontend.cpp
        prefopt.cpp progressdlg.cpp
        project.cpp projectbase.cpp
        projectfilesdlg.cpp projectmanager.cpp
        querypage.cpp querypagebase.cpp
        queryresultsmenu.cpp queryview.cpp
        queryviewdlg.cpp queryviewdriver.cpp
        querywidget.cpp scanprogressdlg.cpp
        searchlist.cpp searchresultsdlg.cpp
        symbolcompletion.cpp symboldlg.cpp
        tabwidget.cpp treewidget.cpp
        ${CMAKE_CURRENT_BINARY_DIR}/dotparse.cpp
        ${CMAKE_CURRENT_BINARY_DIR}/dotscan.cpp
  LINK
     tdeui-shared
     tdeio-shared
     tdecore-shared
     tdeparts-shared
     kateinterfaces-shared
     katepartinterfaces-shared

  DESTINATION ${BIN_INSTALL_DIR}
  DEPENDENCIES dotparse.bison dotscan.lex
)


##### icons

tde_install_icons( ${PROJECT_NAME} )


##### other data

tde_create_translated_desktop( ${PROJECT_NAME}.desktop )

install(
    FILES kscopeui.rc kscope_config
    DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}
)

install(
    FILES file_ro.png file_rw.png file_save.png query_locked.png
          query_unlocked.png tab_list.png call_graph.png called_tree.png
          calling_tree.png bookmark.png
    DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/pics
)
