project(kdenetwork)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )

# search packages used by KDE
find_package(KDE4 REQUIRED)
include (KDE4Defaults)
include (MacroLibrary)

include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckPrototypeExists)
include(CheckTypeSize)
include(MacroBoolTo01)
include(MacroOptionalAddSubdirectory)

# If definitions like -D_GNU_SOURCE are needed for these checks they
# should be added to _KDE4_PLATFORM_DEFINITIONS when it is originally
# defined outside this file.  Here we include these definitions in
# CMAKE_REQUIRED_DEFINITIONS so they will be included in the build of
# checks below.
set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
if (WIN32)
   set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES} )
   set(CMAKE_REQUIRED_INCLUDES  ${KDEWIN32_INCLUDES} )
endif (WIN32)

find_package(KdepimLibs REQUIRED)
find_package(Boost REQUIRED )
# find_package(X11VidMode) not used at this time

macro_optional_find_package(LibVNCServer)
macro_log_feature(LIBVNCSERVER_FOUND "libvncserver" "VNC Server library" "http://libvncserver.sourceforge.net/" FALSE "0.9" "Needed to build Krfb and VNC support in Krdc")

macro_optional_find_package(JPEG)
macro_log_feature(JPEG_FOUND "libjpeg" "Development library for JPEG formatted image files" "http://www.ijg.org/" FALSE "" "Provides JPEG images in Krdc.")

macro_optional_find_package(DNSSD)
macro_log_feature(DNSSD_FOUND "mDNS" "Zeroconf compatible runtime libraries" "http://www.zeroconf.org" FALSE "" "Needed for KDE's service discovery feature Krfb and Krdc and the dnssd ioslave.")

macro_optional_find_package(QCA2)
macro_log_feature(QCA2_FOUND "QCA2" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca" FALSE "2.0.0" "Needed to build Kopete's GroupWise and Jabber protocols.")

macro_optional_find_package(Decibel)
macro_log_feature(DECIBEL_FOUND "Decibel"  "KDE framework for real-time communication" "http://decibel.kde.org/" FALSE "" "Used by the Kopete telepathy protocol.")

macro_optional_find_package(IDN)
macro_log_feature(IDN_FOUND "IDN" "GNU Libidn Internationalized Domain Name (IDN) implemenation" "http://www.gnu.org/software/libidn/" FALSE "" "Used by the Kopete Jabber plugin.")

macro_optional_find_package(Plasma)
macro_log_feature(PLASMA_FOUND "Plasma" "Plasma libraries and header files" "http://plasma.kde.org/" FALSE "" "Plasma is needed for KNewsTicker and the Plasma applet of KGet. Install kdebase-workspace.")

macro_optional_find_package(Soprano)
macro_log_feature(Soprano_FOUND "Soprano" "Semantic Desktop Storing" "" FALSE "" "Soprano is needed for Nepomuk")

macro_optional_find_package(Nepomuk)
macro_log_feature(Nepomuk_FOUND "Nepomuk" "Semantic Desktop" "http://nepomuk.kde.org" FALSE "" "Nepomuk is needed for the integration into KGet")

macro_optional_find_package(Sqlite)
macro_log_feature(SQLITE_FOUND "SQLite" "SQLite is a Binary-Database" "" FALSE "" "Needed for the SQLite-Backend of the KGet-History and the Kopete-Statistic-Plugin")


add_definitions (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})

macro_optional_add_subdirectory(doc)
macro_optional_add_subdirectory(kfile-plugins)
macro_optional_add_subdirectory(kget)
macro_optional_add_subdirectory(kopete)
macro_optional_add_subdirectory(krdc)

if(Q_WS_X11)
  macro_optional_add_subdirectory(kppp)

  if(LIBVNCSERVER_FOUND)
    macro_optional_add_subdirectory(krfb)
  endif(LIBVNCSERVER_FOUND)
endif(Q_WS_X11)

if(PLASMA_FOUND)
    macro_optional_add_subdirectory(knewsticker)
endif(PLASMA_FOUND)

if (DNSSD_FOUND)
   macro_optional_add_subdirectory(kdnssd)
endif (DNSSD_FOUND)

if(NOT WIN32)
  macro_optional_add_subdirectory(filesharing)
endif(NOT WIN32)

macro_display_feature_log()
