set(EXCLUDE_CORE_MODULES "" CACHE STRING
    "Space- or semicolon-separated list of core plug-in modules to exclude from the build")

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

macro(sems_add_core_module mod)
  if(NOT "${mod}" IN_LIST _exclude_core_list)
    add_subdirectory(${mod})
  else()
    message(STATUS "Excluding core module: ${mod}")
  endif()
endmacro()

sems_add_core_module(adpcm)
if(CODEC2_FOUND)
  sems_add_core_module(codec2)
endif(CODEC2_FOUND)
sems_add_core_module(echo)
if(SEMS_USE_SPANDSP)
  sems_add_core_module(g722)
endif(SEMS_USE_SPANDSP)
if(SEMS_USE_G729)
  sems_add_core_module(g729)
endif(SEMS_USE_G729)
if(GSM_FOUND)
  sems_add_core_module(gsm)
endif(GSM_FOUND)
if(SEMS_USE_ILBC)
  sems_add_core_module(ilbc)
endif(SEMS_USE_ILBC)
sems_add_core_module(isac)
sems_add_core_module(l16)
if(SEMS_USE_OPUS)
  sems_add_core_module(opus)
endif(SEMS_USE_OPUS)
sems_add_core_module(session_timer)
# ADD_SUBDIRECTORY (silk)
if(SPEEX_FOUND)
  sems_add_core_module(speex)
endif(SPEEX_FOUND)
sems_add_core_module(stats)
sems_add_core_module(uac_auth)
sems_add_core_module(wav)
