FIND_PACKAGE (RUBY REQUIRED)

SET(UI_CLOCKCONFIG ${CMAKE_CURRENT_SOURCE_DIR}/clockConfig.ui)
SET(UI_CALENDAR ${CMAKE_CURRENT_SOURCE_DIR}/calendar.ui)
SET(UI_TIMEZONESCONFIG ${CMAKE_CURRENT_SOURCE_DIR}/timezonesConfig.ui)
FIND_PROGRAM(RBUIC4 rbuic4 PATHS ${BIN_INSTALL_DIR})
if(RBUIC4)
	ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/analog_clock_config.rb COMMAND ${RBUIC4} ${UI_CLOCKCONFIG} -o ${CMAKE_CURRENT_BINARY_DIR}/analog_clock_config.rb COMMENT "Generating analog_clock_config.rb")
	ADD_CUSTOM_TARGET(clockConfig ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/analog_clock_config.rb)
	ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/calendar.rb COMMAND ${RBUIC4} ${UI_CALENDAR} -o ${CMAKE_CURRENT_BINARY_DIR}/calendar.rb COMMENT "Generating calendar.rb")
	ADD_CUSTOM_TARGET(calendar ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/calendar.rb)
	ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timezones_config.rb COMMAND ${RBUIC4} ${UI_TIMEZONESCONFIG} -o ${CMAKE_CURRENT_BINARY_DIR}/timezones_config.rb COMMENT "Generating timezones_config.rb")
	ADD_CUSTOM_TARGET(timezonesConfig ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/timezones_config.rb)

	install(FILES plasma-applet-ruby-analogclock.desktop DESTINATION ${SERVICES_INSTALL_DIR})
	install(FILES clock.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_applet_ruby_clock)
	install(FILES clockapplet.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_applet_ruby_clock)
	install(FILES ${CMAKE_CURRENT_BINARY_DIR}/analog_clock_config.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_applet_ruby_clock)
	install(FILES ${CMAKE_CURRENT_BINARY_DIR}/calendar.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_applet_ruby_clock)
	install(FILES ${CMAKE_CURRENT_BINARY_DIR}/timezones_config.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_applet_ruby_clock)
else(RBUIC4)
        MESSAGE(STATUS "rbuic4 not found, ruby-clock will not created")
endif(RBUIC4)
