# Copyright(C) 2007,2009 Stefan Siegl <stesie@brokenpipe.de>
#
# kopete_silc - silc plugin for kopete messenger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

find_package(KDE4 REQUIRED)
include (KDE4Defaults)
include (MacroLibrary)

add_subdirectory(icons)

ADD_DEFINITIONS(-O0 -ggdb -DSILC_DIST_SKR -DSILC_DIST_TMA)

# check for libsilc
INCLUDE(${CMAKE_ROOT}/Modules/FindPkgConfig.cmake)
pkg_check_modules (SILC REQUIRED silc)
pkg_check_modules (SILCCLIENT REQUIRED silcclient)

INCLUDE_DIRECTORIES(
  ${SILC_INCLUDE_DIRS} ${SILCCLIENT_INCLUDE_DIRS} 
  ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src
  ${KDE4_INCLUDES} 
  ${KDE4_INCLUDE_DIR}/kopete 
  ${KDE4_INCLUDE_DIR}/kopete/ui)
LINK_DIRECTORIES(${SILC_LIB_DIRS} ${SILCCLIENT_LIB_DIRS} ${KDE4_LIB_DIR})

kde4_add_ui_files(kopete_silc_ui_SRCS
  silcaddcontact.ui
  silcbuddycontactinfo.ui
  silcchannelcontactinfo.ui
  silcchanneljoin.ui
  silceditaccount.ui
)

set(kopete_silc_NOMOC_SRCS
  silcbuddyattributes.cpp
  silcbuddycliententry.cpp
  silcstatusfactory.cpp
)

set(kopete_silc_SRCS
  silcaccount.cpp
  silcaddcontactpage.cpp
  silcbuddycontact.cpp
  silcbuddycontactinfowidget.cpp
  silcchannelcontact.cpp
  silcchannelcontactinfowidget.cpp
  silccontact.cpp
  silccontactmanager.cpp
  silceditaccountwidget.cpp
  silcfiletransfer.cpp
  silcjoindlgwidget.cpp
  silcmessagemanager.cpp
  silcprotocol.cpp
  silcservercontact.cpp
)

foreach(_src_FILE ${kopete_silc_NOMOC_SRCS})
  set_source_files_properties(${_src_FILE} PROPERTIES SKIP_AUTOMOC TRUE)
endforeach(_src_FILE)

kde4_add_plugin(kopete_silc
  ${kopete_silc_SRCS}
  ${kopete_silc_NOMOC_SRCS}
  ${kopete_silc_ui_SRCS}
)

set_target_properties(kopete_silc PROPERTIES 
  COMPILE_FLAGS "${SILC_CFLAGS} ${SILCCLIENT_CFLAGS}")

target_link_libraries(kopete_silc 
  ${KDE4_KDEUI_LIBS} kopete kio
  ${SILC_LDFLAGS}
  ${SILCCLIENT_LDFLAGS}
  -Wl,-no-undefined -Wl,--as-needed
)

install(TARGETS kopete_silc DESTINATION ${PLUGIN_INSTALL_DIR})

