cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE Debug)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

find_package(Qt4 REQUIRED)
set( QT_USE_QTGUI TRUE )
set( QT_USE_QTOPENGL TRUE )
set( QT_USE_QTXML TRUE )
include(${QT_USE_FILE})

# needed: otherwise boost signals name clash
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)

QT4_WRAP_UI(uis_h
   src/MainWindow.ui
   src/SettingsDialog.ui)
# include this for ui_h
include_directories(${CMAKE_CURRENT_BINARY_DIR} include)

set(qt_lib_srcs
   src/xmlRpcTreeItem.cpp
   src/xmlRpcItemDelegate.cpp
   src/xmlRpcModel.cpp)

set(qt_lib_hdrs
   include/rxparamedit/xmlRpcTreeItem.h
   include/rxparamedit/xmlRpcItemDelegate.h
   include/rxparamedit/xmlRpcModel.h)

set(qt_srcs
   src/MainWindow.cpp
   src/settingsDialog.cpp)

set(qt_hdrs
   src/MainWindow.h
   src/settingsDialog.h)


qt4_automoc(${qt_lib_srcs})
QT4_WRAP_CPP(qt_moc_lib_srcs ${qt_lib_hdrs})

qt4_automoc(${qt_srcs})
QT4_WRAP_CPP(qt_moc_srcs ${qt_hdrs})

rosbuild_add_library(xmlRpcModel ${qt_lib_srcs} ${qt_moc_lib_srcs})
target_link_libraries(xmlRpcModel ${QT_LIBRARIES})

rosbuild_add_executable(${PROJECT_NAME} ${uis_h} ${qt_srcs} ${qt_moc_srcs} src/main.cpp)
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} xmlRpcModel)
