

#add_subdirectory( ui ) 
add_subdirectory( icons ) 

message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: skipped subdir $(WEBCAM)")
include_directories( 
${KOPETE_INCLUDES} 
${CMAKE_CURRENT_BINARY_DIR}/ui/ 
${CMAKE_CURRENT_SOURCE_DIR}/ui/ 
)


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

set(kopete_msn_PART_SRCS ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp webcam.cpp )

kde4_automoc(${kopete_msn_PART_SRCS})

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "//autogenerated file by cmake\n#include \"kdemacros.h\"\nextern \"C\" KDE_EXPORT void *init_libkopete_msn_shared();\nextern \"C\" KDE_EXPORT void *init_kopete_msn() { return init_libkopete_msn_shared(); }\n\n")
kde4_add_plugin(kopete_msn ${kopete_msn_PART_SRCS})

kde4_install_libtool_file( ${PLUGIN_INSTALL_DIR} kopete_msn )

target_link_libraries(kopete_msn  ${KDE4_KDECORE_LIBS} kopete_msn_shared )

install(TARGETS kopete_msn  DESTINATION ${PLUGIN_INSTALL_DIR})


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

set(kopete_msn_ui_SRCS ui/msneditaccountwidget.cpp)

kde4_add_ui_files(kopete_msn_ui_SRCS 
   ui/msnadd.ui 
   ui/msndebugrawcommand_base.ui 
   ui/msninfo.ui 
   ui/msneditaccountui.ui
)

set(kopete_msn_shared_LIB_SRCS 
   ${kopete_msn_ui_SRCS}
   msnprotocol.cpp 
   msnaccount.cpp 
   msnaddcontactpage.cpp 
   msncontact.cpp 
   msnsocket.cpp 
   msnchatsession.cpp 
   msndebugrawcmddlg.cpp 
   msnnotifysocket.cpp 
   msnswitchboardsocket.cpp 
   msnfiletransfersocket.cpp 
   msninvitation.cpp 
   sha1.cpp 
   msnsecureloginhandler.cpp 
   msnchallengehandler.cpp 
   dispatcher.cpp 
   p2p.cpp 
   messageformatter.cpp 
   incomingtransfer.cpp 
   outgoingtransfer.cpp 
)

kde4_automoc(${kopete_msn_shared_LIB_SRCS})

kde4_add_library(kopete_msn_shared SHARED ${kopete_msn_shared_LIB_SRCS})

target_link_libraries(kopete_msn_shared  ${KDE4_KIO_LIBS} kopete kopete_videodevice)

set_target_properties(kopete_msn_shared PROPERTIES VERSION 0.0.0 SOVERSION 0 )
install(TARGETS kopete_msn_shared  DESTINATION ${LIB_INSTALL_DIR})


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

install( FILES kopete_msn.desktop  DESTINATION ${SERVICES_INSTALL_DIR})
install( FILES msnchatui.rc  DESTINATION ${DATA_INSTALL_DIR}/kopete_msn)




#original Makefile.am contents follow:

#if include_msn_webcam
#WEBCAM = webcam
## FIXME: Disable compile of this class for now
#WEBCAMCPP=
#WEBCAM_LIBMINICWRAPPER = webcam/libmimicwrapper.la
#endif
#
#KDE_OPTIONS = nofinal
#METASOURCES = AUTO
## Disabled config subdir
#SUBDIRS = ui $(WEBCAM) . icons
#AM_CPPFLAGS = -Iui \
#	-I$(srcdir)/webcam \
#	-I$(srcdir)/ui \
#	$(KOPETE_INCLUDES) \
#	$(all_includes)
#
#kde_module_LTLIBRARIES = kopete_msn.la
#lib_LTLIBRARIES = libkopete_msn_shared.la
#
#CLEANFILES = dummy.cpp
#
#libkopete_msn_shared_la_SOURCES = msnprotocol.cpp msnaccount.cpp \
#	msnaddcontactpage.cpp msncontact.cpp msnsocket.cpp msnchatsession.cpp msndebugrawcmddlg.cpp \
#	msnnotifysocket.cpp msnswitchboardsocket.cpp msnfiletransfersocket.cpp msninvitation.cpp \
#	sha1.cpp msnsecureloginhandler.cpp msnchallengehandler.cpp dispatcher.cpp \
#	p2p.cpp messageformatter.cpp incomingtransfer.cpp outgoingtransfer.cpp \
#	$(WEBCAMCPP)
#
#libkopete_msn_shared_la_LIBADD  = ./ui/libkopetemsnui.la ../../libkopete/libkopete.la $(WEBCAM_LIBMINICWRAPPER) ../../libkopete/avdevice/libkopete_videodevice.la   $(LIB_KIO)
#libkopete_msn_shared_la_LDFLAGS = -version-info 0:0:0 -no-undefined $(all_libraries)
#
#kopete_msn_la_SOURCES = dummy.cpp webcam.cpp
#kopete_msn_la_LIBADD = libkopete_msn_shared.la
#
#kopete_msn_la_LDFLAGS = -no-undefined -module $(KDE_PLUGIN) $(all_libraries)
#
#dummy.cpp: $(srcdir)/Makefile.am
#	echo '#include "kdemacros.h"' > $@
#	echo 'extern "C" KDE_EXPORT void *init_libkopete_msn_shared();' >> $@
#	echo 'extern "C" KDE_EXPORT void *init_kopete_msn() { return init_libkopete_msn_shared(); }' >> $@
#
#service_DATA = kopete_msn.desktop
#servicedir = $(kde_servicesdir)
#
#mydatadir = $(kde_datadir)/kopete_msn
#mydata_DATA = msnchatui.rc
#noinst_HEADERS = p2p.h dispatcher.h messageformatter.h incomingtransfer.h \
#	outgoingtransfer.h webcam.h
