include_directories(${INCLUDES}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MAD_BINARY_DIR}/src/modules) set(STATIC_MODULES "") macro(mad_module name) string(TOUPPER ${name} upper_name) set(WITH_${upper_name} ON CACHE BOOL "Enable module '${name}'") mark_as_advanced(WITH_STATIC_${upper_name}) set(WITH_STATIC_${upper_name} OFF CACHE BOOL "Link module '${name}' statically") if(WITH_${upper_name}) if(WITH_STATIC_${upper_name}) add_library(${name} STATIC ${ARGN}) set(STATIC_MODULES ${STATIC_MODULES} ${name} PARENT_SCOPE) else(WITH_STATIC_${upper_name}) add_library(${name} MODULE ${ARGN}) set_property(TARGET ${name} PROPERTY PREFIX "") endif(WITH_STATIC_${upper_name}) endif(WITH_${upper_name}) endmacro(mad_module) macro(mad_module_libraries name) string(TOUPPER ${name} upper_name) if(WITH_${upper_name}) target_link_libraries(${name} ${ARGN}) endif(WITH_${upper_name}) endmacro(mad_module_libraries) add_subdirectory(FileLogger) add_subdirectory(SystemBackendPosix) add_subdirectory(SystemBackendProc) if(MYSQL_FOUND) add_subdirectory(UserBackendMysql) endif(MYSQL_FOUND) SET(STATIC_MODULE_LOADERS "") SET(STATIC_MODULE_LIST "") foreach(module ${STATIC_MODULES}) SET(STATIC_MODULE_LOADERS "${STATIC_MODULE_LOADERS}Mad::Common::Module* ${module}_create(Mad::Common::Application *application);\n") SET(STATIC_MODULE_LIST "${STATIC_MODULE_LIST}std::make_pair(\"${module}\", &${module}_create),\n") endforeach(module ${STATIC_MODULES}) configure_file(${MAD_SOURCE_DIR}/src/modules/modules.cpp.in ${MAD_BINARY_DIR}/src/modules/modules.cpp) add_library(modules STATIC modules.cpp modules.h ) target_link_libraries(modules ${STATIC_MODULES})