FIND_PACKAGE(Qt4 REQUIRED)

MESSAGE (STATUS "Use file: ${QT_USE_FILE}")

SET(QT_USE_QTXML 1)

include(UseQt4)

include_directories(${QT_INCLUDE_DIR})
include_directories(${QT_QT_INCLUDE_DIR})
include_directories(${QT_QTCORE_INCLUDE_DIR})
include_directories(${QT_QTGUI_INCLUDE_DIR})
include_directories(${QT_QTXML_INCLUDE_DIR})
#include_directories(${QT_QTSVG_INCLUDE_DIR})

#QT4_WRAP_UI(ui_design_main_window.h design_main_window.ui)
QT4_WRAP_UI(ui_general_menu.h operations/general_menu.ui)
QT4_WRAP_UI(ui_newprojectdialog.h projects/newprojectdialog.ui)
QT4_WRAP_UI(ui_projects.h projects/projects.ui)
QT4_WRAP_UI(ui_table_ui.h table_ui.ui)


#QT4_WRAP_CPP(moc_gnuplot_connection gnuplot_connection.h)
QT4_WRAP_CPP(moc_autocomplete autocomplete.h)
QT4_WRAP_CPP(moc_basewidget basewidget.h)
QT4_WRAP_CPP(moc_codeedit codeedit.h)
QT4_WRAP_CPP(moc_command_list command_list.h)
QT4_WRAP_CPP(moc_dynamic_help dynamic_help/dynamic_help.h)
QT4_WRAP_CPP(moc_editor editor.h)
QT4_WRAP_CPP(moc_generate_menu generate_menu.h)
QT4_WRAP_CPP(moc_help help.h)
QT4_WRAP_CPP(moc_main main.h)
QT4_WRAP_CPP(moc_mainwindow mainwindow.h)
QT4_WRAP_CPP(moc_navigator navigator.h)
QT4_WRAP_CPP(moc_numberedtextview numberedtextview.h)
QT4_WRAP_CPP(moc_octave_connection octave_connection.h)
QT4_WRAP_CPP(moc_general_menu operations/general_menu.h)
QT4_WRAP_CPP(moc_table_plot operations/table_plot.h)
QT4_WRAP_CPP(moc_operations operations.h)
QT4_WRAP_CPP(moc_projects projects/projects.h)
QT4_WRAP_CPP(moc_search_dialog search_dialog.h)
QT4_WRAP_CPP(moc_session session.h)
QT4_WRAP_CPP(moc_syntax syntax.h)
QT4_WRAP_CPP(moc_table table.h)
QT4_WRAP_CPP(moc_terminal terminal.h)
QT4_WRAP_CPP(moc_variables_list variables_list.h)
QT4_WRAP_CPP(moc_window_list window_list.h)


add_executable(qtoctave 
	autocomplete.h
	moc_autocomplete.cxx
	basewidget.h
	moc_basewidget.cxx
	codeedit.h
	moc_codeedit.cxx
	command_list.h
	moc_command_list.cxx
	config.h
	dynamic_help/dynamic_help.h
	moc_dynamic_help.cxx
	editor.h
	moc_editor.cxx
	generate_menu.h
	moc_generate_menu.cxx
	help.h
	moc_help.cxx
	main.h
	moc_main.cxx
	mainwindow.h
	moc_mainwindow.cxx
	navigator.h
	moc_navigator.cxx
	numberedtextview.h
	moc_numberedtextview.cxx
	octave_connection.h
	moc_octave_connection.cxx
	operations/general_menu.h
	moc_general_menu.cxx
	operations/table_plot.h
	moc_table_plot.cxx
	operations.h
	moc_operations.cxx
	projects/projects.h
	moc_projects.cxx
	search_dialog.h
	moc_search_dialog.cxx
	session.h
	moc_session.cxx
	syntax.h
	moc_syntax.cxx
	table.h
	moc_table.cxx
	terminal.h
	moc_terminal.cxx
	variables_list.h
	moc_variables_list.cxx
	window_list.h
	moc_window_list.cxx
	autocomplete.cpp
	basewidget.cpp
	codeedit.cpp
	command_list.cpp
	config.cpp
	dynamic_help/dynamic_help.cpp
	editor.cpp
	generate_menu.cpp
	help.cpp
	main.cpp
	mainwindow.cpp
	navigator.cpp
	numberedtextview.cpp
	octave_connection.cpp
	operations/general_menu.cpp
	operations/operations.cpp
	operations/plot.cpp
	operations/table_plot.cpp
	projects/projects.cpp
	search_dialog.cpp
	session.cpp
	syntax.cpp
	table.cpp
	terminal.cpp
	variables_list.cpp
	window_list.cpp
	ui_general_menu.h
	ui_newprojectdialog.h
	ui_projects.h
	ui_table_ui.h

)

SET_TARGET_PROPERTIES(qtoctave
	PROPERTIES INSTALL_RPATH ":usr/lib"
	BUILD_WITH_INSTALL_RPATH true
	INSTALL_RPATH_USE_LINK_PATH true
)

TARGET_LINK_LIBRARIES(qtoctave ${Qt4_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})

install (
		DIRECTORY images octave_doc qtoctave_doc menus
		DESTINATION share/qtoctave
	)

install	(
		PROGRAMS qtoctave
		DESTINATION bin
	)

install (
		FILES config.rc octave.xml
		DESTINATION share/qtoctave
	)