This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
/
CMakeLists.txt
107 lines (91 loc) · 3.35 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
COMPONENT
elektra-doc)
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 ()
list (FIND ADDED_PLUGINS list output)
if (output EQUAL -1
AND ENABLE_TESTING
AND BUILD_TESTING)
message (SEND_ERROR "The required plugin `list` is not selected in PLUGINS but needed for testing, please add `list` to PLUGINS")
endif ()
list (FIND ADDED_PLUGINS spec output)
if (output EQUAL -1
AND (NOT MINGW)
AND ENABLE_TESTING
AND BUILD_TESTING)
message (SEND_ERROR "The required plugin `spec` is not selected in PLUGINS but needed for testing, please add `spec` to PLUGINS")
endif ()
if (BUILD_SHARED)
mkdir (${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
create_lib_symlink (libelektra-${KDB_DEFAULT_STORAGE}.so libelektra-storage.so libelektra${SO_VERSION} PLUGIN)
create_lib_symlink (libelektra-${KDB_DEFAULT_RESOLVER}.so libelektra-resolver.so libelektra${SO_VERSION} PLUGIN)
endif (BUILD_SHARED)