# Copyright(C) 2007 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(KDE3 REQUIRED)
add_subdirectory(icons)

ADD_DEFINITIONS(-O0 -ggdb -DSILC_DIST_SKR -DSILC_DIST_TMA)

# check for libsilc
INCLUDE(${CMAKE_ROOT}/Modules/UsePkgConfig.cmake)
PKGCONFIG(silc SILC_INCLUDE_DIRS SILC_LIB_DIRS SILC_LDFLAGS SILC_CFLAGS)
PKGCONFIG(silcclient SILCCLIENT_INCLUDE_DIRS SILCCLIENT_LIB_DIRS SILCCLIENT_LDFLAGS SILCCLIENT_CFLAGS)

INCLUDE_DIRECTORIES(
  ${SILC_INCLUDE_DIRS} ${SILCCLIENT_INCLUDE_DIRS} 
  ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src
  ${KDE3_INCLUDE_DIRS} 
  ${KDE3_INCLUDE_DIR}/kopete 
  ${KDE3_INCLUDE_DIR}/kopete/ui)
LINK_DIRECTORIES(${SILC_LIB_DIRS} ${SILCCLIENT_LIB_DIRS} ${KDE3_LIB_DIR})

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

set(kopete_silc_NOMOC_SRCS
  silcbuddyattributes.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
)

kde3_automoc(${kopete_silc_SRCS})
KDE3_ADD_KPART(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 
  ${QT_AND_KDECORE_LIBS} kutils kdeui kopete kio
  ${SILC_LDFLAGS}
  ${SILCCLIENT_LDFLAGS}
  -Wl,-no-undefined
)

# configure installation paths
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name")
set(EXEC_INSTALL_PREFIX 
  "${CMAKE_INSTALL_PREFIX}"
  CACHE PATH "Base directory for executables and libraries" FORCE)
set(LIB_INSTALL_DIR
  "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"
  CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
set(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" 
    CACHE PATH "the subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" FORCE)

install(TARGETS kopete_silc DESTINATION ${PLUGIN_INSTALL_DIR})

