summaryrefslogtreecommitdiff
path: root/win/modules/CMakeLists.txt
blob: 386d3600d48561cf803e0ae0e78cc83d0a239b66 (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
# m_regex_stdlib is supported by every version of Visual Studio we support,
# so copy the file out of extra/
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_stdlib.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")

file(GLOB INSPIRCD_MODULES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${INSPIRCD_BASE}/src/commands/*.cpp" "${INSPIRCD_BASE}/src/modules/*.cpp")
list(SORT INSPIRCD_MODULES)

add_definitions("-DDLL_BUILD")

foreach(MODULE_NAME ${INSPIRCD_MODULES})
	string(REGEX REPLACE "^.*[/\\](.*).cpp$" "\\1" BASE_NAME ${MODULE_NAME})
	set(SO_NAME "${BASE_NAME}.so")
	add_library(${SO_NAME} MODULE ${MODULE_NAME})
	set_target_properties(${SO_NAME} PROPERTIES
		PREFIX ""
		SUFFIX ""
		COMPILE_DEFINITIONS "MODNAME=\"${BASE_NAME}\""
	)

	target_link_libraries(${SO_NAME} inspircd)
	add_dependencies(${SO_NAME} inspircd)
	if(MSVC)
		target_link_libraries(${SO_NAME} win32_memory)
		add_dependencies(${SO_NAME} win32_memory)
	endif(MSVC)
	install(TARGETS ${SO_NAME} DESTINATION modules)
endforeach(MODULE_NAME ${INSPIRCD_MODULES})

file(GLOB INSPIRCD_MODULES_SPANNINGTREE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${INSPIRCD_BASE}/src/modules/m_spanningtree/*.cpp")
list(SORT INSPIRCD_MODULES_SPANNINGTREE)

add_library(m_spanningtree.so MODULE ${INSPIRCD_MODULES_SPANNINGTREE})
set_target_properties(m_spanningtree.so PROPERTIES
	PREFIX ""
	SUFFIX ""
	COMPILE_DEFINITIONS "MODNAME=\"m_spanningtree\""
)

target_link_libraries(m_spanningtree.so inspircd)
add_dependencies(m_spanningtree.so inspircd)
if(MSVC)
	target_link_libraries(m_spanningtree.so win32_memory)
	add_dependencies(m_spanningtree.so win32_memory)
endif(MSVC)
install(TARGETS m_spanningtree.so DESTINATION modules)