-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (70 loc) · 2.78 KB
/
CMakeLists.txt
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
include (LibAddPlugin)
if (ADDTESTING_PHASE)
set (COLLECTION_PHASE OFF)
set (DEPENDENCY_PHASE OFF)
set (ADDTESTING_PHASE ON)
foreach (plugin ${ADDED_DIRECTORIES})
set (CMAKE_CURRENT_SOURCE_DIR_TOPSAFE ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_CURRENT_BINARY_DIR_TOPSAFE ${CMAKE_CURRENT_BINARY_DIR})
set (PLUGIN_DIRECTORY_NAME ${plugin})
set (CMAKE_CURRENT_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/plugins/${plugin}")
set (CMAKE_CURRENT_BINARY_DIR "${CMAKE_BINARY_DIR}/src/plugins/${plugin}")
include ("${plugin}/CMakeLists.txt")
set (CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR_TOPSAFE})
set (CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR_TOPSAFE})
endforeach(plugin)
return ()
endif ()
generate_manpage (elektra-plugins FILENAME ${CMAKE_CURRENT_SOURCE_DIR}/README.md SECTION 7)
set (COLLECTION_PHASE ON)
set (DEPENDENCY_PHASE OFF)
set (ADDTESTING_PHASE OFF)
file (GLOB DIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
foreach (plugin ${DIRECTORIES})
#message (STATUS ${plugin})
if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${plugin} AND NOT ${plugin} STREQUAL CMakeFiles)
set (CMAKE_CURRENT_SOURCE_DIR_TOPSAFE ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_CURRENT_BINARY_DIR_TOPSAFE ${CMAKE_CURRENT_BINARY_DIR})
set (PLUGIN_DIRECTORY_NAME ${plugin})
set (CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${plugin}")
set (CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${plugin}")
include ("${plugin}/CMakeLists.txt")
set (CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR_TOPSAFE})
set (CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR_TOPSAFE})
endif ()
endforeach(plugin)
#
# Now ADDED_DIRECTORIES and ADDED_PLUGINS is modified accordingly
#
set (COLLECTION_PHASE OFF)
set (DEPENDENCY_PHASE ON)
set (ADDTESTING_PHASE OFF)
foreach (plugin ${ADDED_DIRECTORIES})
if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${plugin})
set (PLUGIN_DIRECTORY_NAME ${plugin})
add_subdirectory ("${plugin}")
else ()
message (WARNING "${plugin} is not a valid directory")
endif ()
endforeach(plugin)
list (FIND ADDED_PLUGINS ${KDB_DEFAULT_STORAGE} output)
if (output EQUAL -1)
message(SEND_ERROR "selected default storage (${KDB_DEFAULT_STORAGE}) is not selected in PLUGINS, please change KDB_DEFAULT_STORAGE or PLUGINS")
endif()
list (FIND ADDED_PLUGINS ${KDB_DEFAULT_RESOLVER} output)
if (output EQUAL -1)
message(SEND_ERROR "selected default resolver (${KDB_DEFAULT_RESOLVER}) is not selected in PLUGINS, please change KDB_DEFAULT_RESOLVER or PLUGINS")
endif()
if (BUILD_SHARED)
mkdir (${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
create_lib_symlink (
libelektra-${KDB_DEFAULT_STORAGE}.so
libelektra-storage.so
PLUGIN
)
create_lib_symlink (
libelektra-${KDB_DEFAULT_RESOLVER}.so
libelektra-resolver.so
PLUGIN
)
endif (BUILD_SHARED)