MACRO (MACRO_KT_PLUGIN _option _name _dir)
option(${_option} "Whether to build the ${_name} plugin or not" true)
if (${_option})
  message(STATUS "Building ${_name} plugin (-D${_option}=false to disable)")
  add_subdirectory(${_dir})
else (${_option})
  message(STATUS "Not building ${_name} plugin (-D${_option}=true to enable)")
endif (${_option})
ENDMACRO (MACRO_KT_PLUGIN)

macro_kt_plugin(ENABLE_LOGVIEWER_PLUGIN logviewer logviewer)
macro_kt_plugin(ENABLE_INFOWIDGET_PLUGIN infowidget infowidget)
if (HAVE_KF5Completion)
    macro_kt_plugin(ENABLE_UPNP_PLUGIN upnp upnp)
endif()
if (HAVE_Qt5WebEngineWidgets)
  macro_kt_plugin(ENABLE_SEARCH_PLUGIN search search)
endif()
macro_kt_plugin(ENABLE_SCANFOLDER_PLUGIN scanfolder scanfolder)
macro_kt_plugin(ENABLE_SCANFOLDER_PLUGIN scanforlostfiles scanforlostfiles)
if(HAVE_QT5_Test)
  set(HAVE_QT5_Test2 1)
endif()
if (HAVE_KF5TextWidgets)
    macro_kt_plugin(ENABLE_IPFILTER_PLUGIN ipfilter ipfilter)
endif()
if (HAVE_KF5Plotting)
    macro_kt_plugin(ENABLE_STATS_PLUGIN stats stats)
endif()
macro_kt_plugin(ENABLE_BWSCHEDULER_PLUGIN bwscheduler bwscheduler)
if (HAVE_Taglib AND PHONON_FOUND_EXPERIMENTAL) #AND Qt5Multimedia_FOUND)
  macro_kt_plugin(ENABLE_MEDIAPLAYER_PLUGIN mediaplayer mediaplayer)
endif()
if (HAVE_KF5Syndication AND HAVE_Qt5WebEngineWidgets)
  macro_kt_plugin(ENABLE_SYNDICATION_PLUGIN syndication syndication)
endif()
macro_kt_plugin(ENABLE_DOWNLOADORDER_PLUGIN downloadorder downloadorder)
if (HAVE_LibKWorkspace)
  macro_kt_plugin(ENABLE_SHUTDOWN_PLUGIN shutdown shutdown)
endif()
if (HAVE_KF5DNSSD)
  macro_kt_plugin(ENABLE_ZEROCONF_PLUGIN zeroconf zeroconf)
endif()
macro_kt_plugin(ENABLE_MAGNETGENERATOR_PLUGIN magnetgenerator magnetgenerator)
