
#add_subdirectory(noatuntags)
add_subdirectory(noatun)

# libnoatun is a qt3 free zone ;)
remove_definitions(-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)

include_directories(
	${CMAKE_SOURCE_DIR}/noatun/library/noatun
	${CMAKE_SOURCE_DIR}/noatun/library
)


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

set(noatun_LIB_SRCS
	config.cpp
	controls.cpp
	frontend.cpp
	global.cpp
	hardwarevc.cpp
	nmainwindow.cpp
	player.cpp
	playlist.cpp
	playlistitem.cpp
	playlistsaver.cpp
	plugin.cpp
	plugininterfaces.cpp
	pluginloader.cpp
	preferencesdialog.cpp
	preferencespage.cpp
	scrollinglabel.cpp
	stdaction.cpp
	stereobuttonaction.cpp)

set(header_file_to_automoc
	noatun/config.h
	noatun/controls.h
	noatun/frontend.h
	noatun/global.h
	noatun/nmainwindow.h
	noatun/player.h
	noatun/playlist.h
	noatun/playlistitem.h
	noatun/playlistsaver.h
	noatun/plugin.h
	noatun/plugininterfaces.h
	noatun/pluginloader.h
	noatun/preferencesdialog.h
	noatun/preferencespage.h
	noatun/scrollinglabel.h
	noatun/stdaction.h
	noatun/stereobuttonaction.h
	)

# hack to allow moc creation with .cpp and .h being in different directories
foreach(_headerfile ${header_file_to_automoc})
	GET_FILENAME_COMPONENT(outfile ${_headerfile} NAME_WE)
	qt4_generate_moc(${_headerfile} ${CMAKE_CURRENT_BINARY_DIR}/${outfile}.moc)
	set_source_files_properties(${CMAKE_SOURCE_DIR}/noatun/library/${outfile}.cpp PROPERTIES SKIP_AUTOMOC TRUE)
	macro_add_file_dependencies(${CMAKE_SOURCE_DIR}/noatun/library/${outfile}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${outfile}.moc)
endforeach(_headerfile ${headerfile})

kde4_automoc(${noatun_LIB_SRCS})

kde4_add_library(noatun SHARED ${noatun_LIB_SRCS})

target_link_libraries(noatun  ${KDE4_KIO_LIBS} )

set_target_properties(noatun PROPERTIES VERSION 1.2.0 SOVERSION 1 )
install(TARGETS noatun  DESTINATION ${LIB_INSTALL_DIR} )

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

install( FILES noatun_export.h DESTINATION ${INCLUDE_INSTALL_DIR}/noatun/ )

# XMLGUI
install( FILES noatun.rc DESTINATION ${DATA_INSTALL_DIR}/noatun )

# Plugin ServiceType
install( FILES noatunplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
