set(EXCLUDE_DSM_MODULES "" CACHE STRING
    "Space- or semicolon-separated list of DSM modules to exclude from the build")

# Normalize: replace spaces with semicolons to form a proper CMake list
string(REPLACE " " ";" _exclude_dsm_list "${EXCLUDE_DSM_MODULES}")

macro(sems_add_dsm_module mod)
  if(NOT "${mod}" IN_LIST _exclude_dsm_list)
    add_subdirectory(${mod})
  else()
    message(STATUS "Excluding DSM module: ${mod}")
  endif()
endmacro()

# ADD_SUBDIRECTORY (mod_aws)
sems_add_dsm_module(mod_conference)
find_package(CURL QUIET)
if(CURL_FOUND)
  sems_add_dsm_module(mod_curl)
endif(CURL_FOUND)
sems_add_dsm_module(mod_dlg)
sems_add_dsm_module(mod_groups)
if(SEMS_USE_MONITORING)
  sems_add_dsm_module(mod_monitoring)
endif(SEMS_USE_MONITORING)
if(MYSQLCPPCONN_FOUND)
  sems_add_dsm_module(mod_mysql)
endif(MYSQLCPPCONN_FOUND)
if(SEMS_USE_PYTHON)
  sems_add_dsm_module(mod_py)
endif(SEMS_USE_PYTHON)
if(HIREDIS_FOUND)
  sems_add_dsm_module(mod_redis)
endif(HIREDIS_FOUND)
sems_add_dsm_module(mod_regex)
sems_add_dsm_module(mod_sbc)
sems_add_dsm_module(mod_subscription)
sems_add_dsm_module(mod_sys)
sems_add_dsm_module(mod_uri)
sems_add_dsm_module(mod_utils)
find_package(LibXml2 QUIET)
if(LIBXML2_FOUND)
  sems_add_dsm_module(mod_xml)
endif(LIBXML2_FOUND)
if(SEMS_USE_ZRTP)
  sems_add_dsm_module(mod_zrtp)
endif(SEMS_USE_ZRTP)
