project(qonjugatorgui)
cmake_minimum_required(VERSION 2.6)

### don't create the uninstall rule if this application is compiled as part of the Qonjugator package
if (qonjugator_compile_not_standalone)
	set(qonjugator_uninstall_rule_created TRUE)
endif (qonjugator_compile_not_standalone)

### include application defaults
include(../ConfigureDefaults.cmake)

### find the Qonjugator library and set some useful definitions
find_package(QonjugatorLib REQUIRED)
add_definitions(-DQT_NO_DEBUG -DQT_SHARED)
include_directories(${QONJUGATOR_INCLUDES})
include_directories(${CMAKE_BINARY_DIR}/qonjugatorgui) # it seems that on Mandriva this directory is not searched for ui_*.h files

include_directories(.)
add_definitions(-DAPPNAME=\"Qonjugator\" -DAPPVERSION=\"0.15\")
add_definitions(-DQONJ_INSTALL_CSS=\"${QONJUGATOR_SHAREDDIR}/qonjugator.css\")

### include custom paths defined by the user
include(ConfigureCustom.cmake)

### tell the user where we will install everything
message("Qonjugator GUI Application")
message("   The application binary will be installed in ${QONJUGATOR_BINDIR}")
message("   The translations will be installed in ${QONJUGATOR_TRANSLATIONSDIR}")
message("   The desktop file will be installed in ${QONJUGATOR_DESKTOPDIR}")
message("   The example CSS file will be installed in ${QONJUGATOR_SHAREDDIR}")

### compile
set(qonjugatorgui_SRCS
    aboutdialog.cpp
    configappearancewidget.cpp
    configdialog.cpp
    configgeneralwidget.cpp
    configpluginappearancedelegate.cpp
    configpluginappearanceedit.cpp
    lineedit.cpp
    main.cpp
    mainwindow.cpp
    qonjugatorapp.cpp
    qonjugatortextbrowser.cpp
	qonjugatoroutputhtml.cpp
	recentverbscontroller.cpp
    specialcharstablewidget.cpp
    specialcharswidget.cpp)
set(qonjugatorgui_MOC_HDRS
    aboutdialog.h
    configappearancewidget.h
    configdialog.h
    configgeneralwidget.h
    configpluginappearancedelegate.h
    configpluginappearanceedit.h
    lineedit.h
    mainwindow.h
    qonjugatorapp.h
    qonjugatortextbrowser.h
	qonjugatoroutputhtml.h
	recentverbscontroller.h
    specialcharstablewidget.h
    specialcharswidget.h)
qt4_wrap_cpp(qonjugatorgui_MOC_SRCS
             ${qonjugatorgui_MOC_HDRS})
qt4_wrap_ui(qonjugatorgui_UI
            aboutdialog.ui
            configappearancewidget.ui
            configdialog.ui
            configgeneralwidget.ui
            mainwindow.ui
            specialcharswidget.ui)
qt4_add_resources(qonjugatorgui_RSRCS
                  qonjugator.qrc)
qt4_add_translation(qonjugatorgui_TRANS
                    qonjugatorgui_cs.ts
                    qonjugatorgui_es.ts
                    qonjugatorgui_fr.ts)

add_executable(qonjugator
               ${qonjugatorgui_SRCS}
               ${qonjugatorgui_MOC_SRCS}
               ${qonjugatorgui_UI}
               ${qonjugatorgui_RSRCS}
               ${qonjugatorgui_TRANS})
target_link_libraries(qonjugator
                      ${QT_LIBRARIES} ${QONJUGATOR_LIBRARIES})

### install
install(TARGETS qonjugator
        DESTINATION ${QONJUGATOR_BINDIR})
install(FILES ${qonjugatorgui_TRANS}
        DESTINATION ${QONJUGATOR_TRANSLATIONSDIR})
install(FILES qonjugator.css
        DESTINATION ${QONJUGATOR_SHAREDDIR})
if (CMAKE_SYSTEM_NAME MATCHES Linux)
	install(FILES qonjugator.desktop
	        DESTINATION ${QONJUGATOR_DESKTOPDIR})
#	install(FILES qonjugator.png
#	        DESTINATION ${QONJUGATOR_ICONDIR})
endif(CMAKE_SYSTEM_NAME MATCHES Linux)
