blob: e5890f4bb03fc0838fcbc19e2460962f2d7d0329 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
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})
set_target_properties(${name} PROPERTIES DEFINE_SYMBOL "MAD_MODULE_EXPORTS")
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} Common Net Core ${ARGN})
endif(WITH_${upper_name})
endmacro(mad_module_libraries)
add_subdirectory(AuthBackendFile)
add_subdirectory(FileLogger)
if(UNIX)
add_subdirectory(SystemBackendPosix)
add_subdirectory(SystemBackendProc)
add_subdirectory(UserConfigBackendHome)
endif(UNIX)
if(MYSQL_FOUND)
add_subdirectory(UserDBBackendMysql)
endif(MYSQL_FOUND)
if(KRB5_FOUND)
add_subdirectory(UserConfigBackendKrb5)
endif(KRB5_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::pair<const std::string, const ModuleLoadFunc>(0, 0)(\"${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
export.h
${MAD_BINARY_DIR}/src/modules/modules.cpp modules.h
)
target_link_libraries(modules ${STATIC_MODULES})
|