project(kweather)
add_definitions (-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)
add_subdirectory( graphics ) 
add_subdirectory( tests ) 

set(weather_service_interface_SRCS)
qt4_add_dbus_interfaces( weather_service_interface_SRCS org.kde.kweather.service.xml )


########### next target ###############

set(kweatherservice_SRCS 
   main.cpp 
   metar_parser.cpp 
   weatherlib.cpp 
   weatherservice.cpp 
   stationdatabase.cpp 
   sun.cpp )

qt4_add_dbus_adaptor( kweatherservice_SRCS org.kde.kweather.service.xml weatherservice.h WeatherService )


kde4_add_executable(kweatherservice ${kweatherservice_SRCS})

target_link_libraries(kweatherservice  ${KDE4_KIO_LIBS} ${QT_QT3SUPPORT_LIBRARY})

install(TARGETS kweatherservice ${INSTALL_TARGETS_DEFAULT_ARGS})


########### next target ###############

set(kweatherreport_KDEINIT_SRCS reportmain.cpp reportview.cpp ${weather_service_interface_SRCS} )



kde4_add_kdeinit_executable( kweatherreport ${kweatherreport_KDEINIT_SRCS})

target_link_libraries(kdeinit_kweatherreport ${KDE4_KHTML_LIBS})

install(TARGETS kdeinit_kweatherreport ${INSTALL_TARGETS_DEFAULT_ARGS})

target_link_libraries( kweatherreport kdeinit_kweatherreport )
install(TARGETS kweatherreport ${INSTALL_TARGETS_DEFAULT_ARGS})

########### next target ###############
#set(weather_panelapplet_PART_SRCS  
#   reportview.cpp 
#   kweather.cpp 
#   dockwidget.cpp 
#   weatherbutton.cpp ${weather_service_interface_SRCS})
#qt4_add_dbus_adaptor( weather_panelapplet_PART_SRCS org.kde.kweather.kweather.xml kweather.h kweather )


#kde4_add_plugin(weather_panelapplet ${weather_panelapplet_PART_SRCS})


#target_link_libraries(weather_panelapplet  ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KHTML_LIBS} ${KDE4_KUTILS_LIBS} )

#install(TARGETS weather_panelapplet  DESTINATION ${PLUGIN_INSTALL_DIR})


########### next target ###############

set(kcm_weather_PART_SRCS kcmweather.cpp ${weather_service_interface_SRCS})


kde4_add_ui_files(kcm_weather_PART_SRCS prefdialogdata.ui )

kde4_add_plugin(kcm_weather ${kcm_weather_PART_SRCS})


target_link_libraries(kcm_weather  ${KDE4_KDE3SUPPORT_LIBS}  )

install(TARGETS kcm_weather  DESTINATION ${PLUGIN_INSTALL_DIR})


########### next target ###############

set(kcm_weatherservice_PART_SRCS kcmweatherservice.cpp serviceconfigwidget.cpp ${weather_service_interface_SRCS})


kde4_add_ui_files(kcm_weatherservice_PART_SRCS serviceconfigdata.ui )


kde4_add_plugin(kcm_weatherservice ${kcm_weatherservice_PART_SRCS})


target_link_libraries(kcm_weatherservice  ${KDE4_KDE3SUPPORT_LIBS} )

install(TARGETS kcm_weatherservice  DESTINATION ${PLUGIN_INSTALL_DIR})


########### install files ###############

install( FILES kweatherservice.desktop  DESTINATION ${SERVICES_INSTALL_DIR})
install( FILES kcmweather.desktop kcmweatherservice.desktop  DESTINATION ${SERVICES_INSTALL_DIR})
install( FILES weather_stations.desktop  DESTINATION ${DATA_INSTALL_DIR}/kweatherservice)
#install( FILES kweather.desktop  DESTINATION ${DATA_INSTALL_DIR}/kicker/applets)
install( FILES stations.dat  DESTINATION ${DATA_INSTALL_DIR}/kweatherservice)
install( FILES org.kde.kweather.kweather.xml  org.kde.kweather.service.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
kde4_install_icons( ${ICON_INSTALL_DIR}  )


