/
BareosFindAllLibraries.cmake
204 lines (177 loc) · 5.35 KB
/
BareosFindAllLibraries.cmake
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2023 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
# License as published by the Free Software Foundation and included
# in the file LICENSE.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
include(systemdservice)
if(${SYSTEMD_FOUND})
set(HAVE_SYSTEMD 1)
endif()
option(ENABLE_PYTHON "Enable Python support" ON)
if(NOT ENABLE_PYTHON)
set(HAVE_PYTHON 0)
set(Python3_FOUND 0)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(HAVE_PYTHON 1)
set(Python3_FOUND 1)
set(Python3_EXT_SUFFIX ".pyd")
# Python Plugins currently cannot be built for Solaris
elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set(HAVE_PYTHON 0)
set(Python3_FOUND 0)
else()
find_package(Python3 COMPONENTS Interpreter Development)
set(Python3_VERSION_MAJOR
${Python3_VERSION_MAJOR}
PARENT_SCOPE
)
set(Python3_VERSION_MINOR
${Python3_VERSION_MINOR}
PARENT_SCOPE
)
if(${Python3_FOUND})
set(HAVE_PYTHON 1)
endif()
if(${Python3_FOUND})
set(PYTHON_EXECUTABLE
${Python3_EXECUTABLE}
PARENT_SCOPE
)
set(Python3_EXECUTABLE
${Python3_EXECUTABLE}
PARENT_SCOPE
)
execute_process(
COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/get_python_compile_settings.py
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/py3settings.cmake
)
include(${CMAKE_CURRENT_BINARY_DIR}/py3settings.cmake)
endif()
endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include(FindPostgreSQL)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(OPENSSL_USE_STATIC_LIBS 1)
endif()
include(FindOpenSSL)
if(${OPENSSL_FOUND})
set(HAVE_OPENSSL 1)
if(OPENSSL_VERSION VERSION_LESS "1.0.2")
message(FATAL_ERROR "Need at least OpenSSL version 1.0.2")
endif()
endif()
include(BareosFindLibraryAndHeaders)
bareosfindlibraryandheaders(
"vixDiskLib" "vixDiskLib.h"
"/usr/lib/vmware-vix-disklib-distrib;/usr/lib/vmware-vix-disklib"
)
# check for structmember physicalSectorSize in struct VixDiskLibCreateParams
if(VIXDISKLIB_FOUND)
include(CheckStructHasMember)
check_struct_has_member(
"VixDiskLibCreateParams" physicalSectorSize
${VIXDISKLIB_INCLUDE_DIRS}/vixDiskLib.h
VIXDISKLIBCREATEPARAMS_HAS_PHYSICALSECTORSIZE
)
endif()
if(VIXDISKLIB_FOUND)
if((NOT DEFINED vmware_server)
OR (NOT DEFINED vmware_user)
OR (NOT DEFINED vmware_password)
OR (NOT DEFINED vmware_datacenter)
OR (NOT DEFINED vmware_folder)
)
string(
CONCAT MSG
"VMware Vix Disklib was found. To enable the vmware plugin test, "
"please provide the required information:"
"example:"
" -Dvmware_user=Administrator@vsphere.local "
" -Dvmware_password=\"@one2threeBareos\" "
" -Dvmware_vm_name=testvm1 "
" -Dvmware_datacenter=mydc1 "
" -Dvmware_folder=\"/webservers\" "
" -Dvmware_server=139.178.73.195"
)
message(WARNING ${MSG})
else()
set(enable_vmware_test
1
PARENT_SCOPE
)
endif()
elseif(
(DEFINED vmware_server)
OR (DEFINED vmware_user)
OR (DEFINED vmware_password)
OR (DEFINED vmware_datacenter)
OR (DEFINED vmware_folder)
)
message(
FATAL_ERROR
"vmware options were set but VMware Vix Disklib was not found. Cannot run vmware tests."
)
endif()
bareosfindlibraryandheaders("pthread" "pthread.h" "")
bareosfindlibraryandheaders("cap" "sys/capability.h" "")
bareosfindlibraryandheaders("gfapi" "glusterfs/api/glfs.h" "")
bareosfindlibraryandheaders("pam" "security/pam_appl.h" "")
option(ENABLE_LZO "Enable LZO support" ON)
if(ENABLE_LZO)
bareosfindlibraryandheaders("lzo2" "lzo/lzoconf.h" "")
if(${LZO2_FOUND})
set(HAVE_LZO 1)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LZO2_LIBRARIES "/usr/local/opt/lzo/lib/liblzo2.a")
endif()
endif()
endif()
include(BareosFindLibrary)
bareosfindlibrary("tirpc")
bareosfindlibrary("util")
bareosfindlibrary("dl")
bareosfindlibrary("acl")
if(NOT ${CMAKE_CXX_COMPILER_ID} MATCHES SunPro)
find_package(GTest 1.8 CONFIG)
endif()
if(${HAVE_CAP})
set(HAVE_LIBCAP 1)
endif()
find_package(ZLIB)
if(${ZLIB_FOUND})
set(HAVE_LIBZ 1)
endif()
find_package(Readline)
option(ENABLE_JANSSON "Build with Jansson library (required for director)" ON)
if(ENABLE_JANSSON)
find_package(Jansson)
endif()
if(USE_SYSTEM_CLI11)
find_package(CLI11 "2.2.0" CONFIG REQUIRED)
message(STATUS "Using system CLI11 ${CLI11_VERSION}")
endif()
if(USE_SYSTEM_FMT)
find_package(fmt "6.2.1" CONFIG REQUIRED)
message(STATUS "Using system fmt ${fmt_VERSION}")
endif()
if(USE_SYSTEM_XXHASH)
find_package(PkgConfig REQUIRED)
pkg_search_module(XXHASH REQUIRED IMPORTED_TARGET xxhash>=0.8.1)
message(STATUS "Using system xxHash ${XXHASH_VERSION}")
endif()
include(thread)