option(WITH_testbed "Enable Kopete testbed protocol" ON)
option(WITH_oscar "Enable Kopete Oscar (ICQ and AIM) protocol" ON)
option(WITH_yahoo "Enable Kopete Yahoo protocol" ON)
option(WITH_qq "Enable Kopete QQ protocol" ON)
option(WITH_sms "Enable Kopete SMS protocol" ON)
option(WITH_groupwise "Enable Novell GroupWise Messenger protocol" ON)
option(WITH_winpopup "Enable Kopete winpopup protocol" ON)
option(WITH_gadu "Enable Kopete Gadu-Gadu protocol" ON)
option(WITH_jabber "Enable Kopete Jabber protocol" ON)
option(WITH_libjingle "Enable Kopete Jabber libjingle support" ON)
option(WITH_bonjour "Enable Kopete Bonjour protocol" ON)
option(WITH_wlm "Enable Window Live Messenger support" ON)
option(WITH_WLM_MEDIASTREAMER "Enable Windows Live Messenger voice clip support" ON)
option(WITH_meanwhile "Enable Kopete meanwhile protocol" ON)
option(WITH_skype "Enable Kopete Skype protocol" ON)

# Disable jingle support because it is not working and libiris does not support it
#if(LIBORTP_FOUND AND SPEEX_FOUND AND ALSA_FOUND AND WITH_JINGLE)
#  message(STATUS "Building jingle support")
#  set(BUILD_JINGLE TRUE)
#else()
#  message(STATUS "Not building jingle support (recommended)")
#  set(BUILD_JINGLE FALSE)
#endif()
set(BUILD_JINGLE FALSE)

if(OPENSSL_FOUND OR WIN32)
  if(EXPAT_FOUND AND LIBORTP_FOUND AND SRTP_FOUND AND JSONCPP_FOUND AND MEDIASTREAMER_FOUND AND WITH_libjingle)
    message(STATUS "Building jabber libjingle support")
    set(BUILD_LIBJINGLE TRUE)
  else()
    message(STATUS "Not building jabber libjingle support")
    set(BUILD_LIBJINGLE FALSE)
  endif()
else()
  message(STATUS "Not building jabber libjingle support")
  set(BUILD_LIBJINGLE FALSE)
endif()

if(MEDIASTREAMER_FOUND AND LIBORTP_FOUND AND WITH_WLM_MEDIASTREAMER)
  message(STATUS "Building Windows Live Messenger voice clip support")
  set(BUILD_WLM_MEDIASTREAMER TRUE)
else()
  message(STATUS "Not building Windows Live Messenger voice clip support")
  set(BUILD_WLM_MEDIASTREAMER FALSE)
endif()

include_directories(${KOPETE_INCLUDES})

if(WITH_wlm AND LIBMSN_FOUND AND Boost_FOUND)
  add_subdirectory( wlm )
endif()

if(WITH_oscar)
  add_subdirectory( oscar )
endif()
if(WITH_yahoo AND JASPER_FOUND)
  add_subdirectory( yahoo )
endif()
if(WITH_qq)
  add_subdirectory( qq )
endif()
if(NOT WIN32)
  if(WITH_winpopup)
    add_subdirectory( winpopup )
  endif()
  if(WITH_gadu AND LIBGADU_FOUND)
    add_subdirectory( gadu )
  endif()
  message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: WARNING: sms plugin disabled")

#  if(WITH_sms)
#    add_subdirectory( sms )
#  endif()
  message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: WARNING: skype plugin disabled")
#  if(NOT APPLE AND WITH_skype)
#    add_subdirectory( skype )
#  endif()
endif()

if(Qca-qt5_FOUND AND ZLIB_FOUND)
  if(IDN_FOUND)
    if(WITH_jabber)
      add_subdirectory( jabber )
    endif()
  else()
    message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled Jabber because libidn-devel was not found")
  endif()
  if(WITH_groupwise)
    add_subdirectory( groupwise )
  endif()
else()
  message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled GroupWise and Jabber because QCA2 was not found")
endif()

if(WITH_testbed)
  add_subdirectory( testbed )
endif()

if(WITH_bonjour)
  add_subdirectory( bonjour )
endif()

if(WITH_meanwhile)
  if(LIBMEANWHILE_FOUND)
    add_subdirectory( meanwhile )
  else()
    message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled Meanwhile beause libmeanwhile was not found")
  endif()
endif()

