-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
285 lines (266 loc) · 8.29 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# This file is part of libvbox
# Copyright (C) 2019 Michael Hansen
#
# libvbox is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# libvbox 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with libvbox; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cmake_minimum_required(VERSION 3.5)
project(libvbox)
include(FeatureSummary)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
find_package(VirtualBoxSDK REQUIRED)
set_package_properties(VirtualBoxSDK PROPERTIES
URL "https://www.virtualbox.org/wiki/Downloads"
TYPE REQUIRED
)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()
if(POLICY CMP0115)
# Old versions of CMake allow you to specify file names without an extension,
# meaning configured file names which differ in only a ".in" suffix were
# ambiguous. This shuts up the warning, since we already do the right thing.
cmake_policy(SET CMP0115 NEW)
endif()
configure_file(
include/libvbox_vboxsdk_version.h.in
include/libvbox_vboxsdk_version.h
@ONLY
)
add_library(vbox SHARED "")
if(MSVC)
# Keep the "libvbox" name even on MSVC
set_target_properties(vbox PROPERTIES PREFIX "lib")
endif()
target_include_directories(vbox
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
target_compile_definitions(vbox
PRIVATE
BUILDING_LIBVBOX
)
target_sources(vbox
PRIVATE
include/libvbox.h
include/libvbox_errors.h
include/libvbox_interfaces.h
include/libvbox_vboxsdk_types.h
include/libvbox_vboxsdk_version.h
include/libvbox_wrap.h
lib/libvbox_p.h
lib/additionsfacility.cpp
lib/appliance.cpp
lib/audioadapter.cpp
lib/audiosettings.cpp
lib/bandwidthcontrol.cpp
lib/bandwidthgroup.cpp
lib/biossettings.cpp
lib/certificate.cpp
lib/clipboardevent.cpp
lib/cloudclient.cpp
lib/cloudmachine.cpp
lib/cloudnetwork.cpp
lib/cloudprofile.cpp
lib/cloudprofileevent.cpp
lib/cloudprovider.cpp
lib/cloudproviderevent.cpp
lib/cloudprovidermanager.cpp
lib/comstring.cpp
lib/console.cpp
lib/cpuchangedevent.cpp
lib/cpuprofile.cpp
lib/cursorpositionchangedevent.cpp
lib/datastream.cpp
lib/dhcpconfig.cpp
lib/dhcpgroupcondition.cpp
lib/dhcpserver.cpp
lib/directory.cpp
lib/display.cpp
lib/displaysourcebitmap.cpp
lib/dndbase.cpp
lib/dndsource.cpp
lib/dndtarget.cpp
lib/emulatedusb.cpp
lib/errorwrap.cpp
lib/event.cpp
lib/eventlistener.cpp
lib/eventsource.cpp
lib/extpack.cpp
lib/extpackinstalledevent.cpp
lib/extpackmanager.cpp
lib/extpackplugin.cpp
lib/extradatachangedevent.cpp
lib/file.cpp
lib/firmwaresettings.cpp
lib/form.cpp
lib/formvalue.cpp
lib/framebuffer.cpp
lib/framebufferoverlay.cpp
lib/fsinfo.cpp
lib/fsobjinfo.cpp
lib/graphicsadapter.cpp
lib/guest.cpp
lib/guestadditionsstatuschangedevent.cpp
lib/guestdebugcontrol.cpp
lib/guestdebugcontrolchangedevent.cpp
lib/guestdirectoryevent.cpp
lib/guestfileevent.cpp
lib/guestfileioevent.cpp
lib/guestkeyboardevent.cpp
lib/guestmonitorchangedevent.cpp
lib/guestmouseevent.cpp
lib/guestmultitouchevent.cpp
lib/guestostype.cpp
lib/guestprocessevent.cpp
lib/guestprocessioevent.cpp
lib/guestscreeninfo.cpp
lib/guestsession.cpp
lib/guestsessionevent.cpp
lib/guestuserstatechangedevent.cpp
lib/host.cpp
lib/hostaudiodevice.cpp
lib/hostaudiodevicechangedevent.cpp
lib/hostdrive.cpp
lib/hostdrivepartition.cpp
lib/hostnetworkinterface.cpp
lib/hostonlynetwork.cpp
lib/hostpcideviceplugevent.cpp
lib/hostvideoinputdevice.cpp
lib/internalmachinecontrol.cpp
lib/internalprogresscontrol.cpp
lib/internalsessioncontrol.cpp
lib/keyboard.cpp
lib/keyboardledschangedevent.cpp
lib/languagechangedevent.cpp
lib/machine.cpp
lib/machinedebugger.cpp
lib/machineevent.cpp
lib/medium.cpp
lib/mediumattachment.cpp
lib/mediumevent.cpp
lib/mediumformat.cpp
lib/mediumio.cpp
lib/modechangedevent.cpp
lib/mouse.cpp
lib/mousecapabilitychangedevent.cpp
lib/mousepointershape.cpp
lib/mousepointershapechangedevent.cpp
lib/natengine.cpp
lib/natnetwork.cpp
lib/natnetworkchangedevent.cpp
lib/natredirectevent.cpp
lib/networkadapter.cpp
lib/nvramstore.cpp
lib/objchangedevent.cpp
lib/parallelport.cpp
lib/pciaddress.cpp
lib/pcideviceattachment.cpp
lib/performancecollector.cpp
lib/performancemetric.cpp
lib/platform.cpp
lib/platformproperties.cpp
lib/platformx86.cpp
lib/process.cpp
lib/progress.cpp
lib/progressevent.cpp
lib/recordingevent.cpp
lib/recordingscreensettings.cpp
lib/recordingsettings.cpp
lib/resourcestore.cpp
lib/reusableevent.cpp
lib/runtimeerrorevent.cpp
lib/serialport.cpp
lib/session.cpp
lib/sharedfolder.cpp
lib/showwindowevent.cpp
lib/snapshot.cpp
lib/snapshotevent.cpp
lib/statechangedevent.cpp
lib/storagecontroller.cpp
lib/stringarray.cpp
lib/systemproperties.cpp
lib/token.cpp
lib/trustedplatformmodule.cpp
lib/uefivariablestore.cpp
lib/unattended.cpp
lib/updateagent.cpp
lib/updateagentavailableevent.cpp
lib/updateagentevent.cpp
lib/usbcontroller.cpp
lib/usbdevice.cpp
lib/usbdevicefilter.cpp
lib/usbdevicefilters.cpp
lib/usbproxybackend.cpp
lib/vboxwrap.cpp
lib/vetoevent.cpp
lib/vfsexplorer.cpp
lib/virtualbox.cpp
lib/virtualboxclient.cpp
lib/virtualboxerrorinfo.cpp
lib/virtualsystemdescription.cpp
lib/vrdeserver.cpp
lib/vrdeserverinfo.cpp
${VirtualBoxSDK_IID_LIB}
)
target_link_libraries(vbox PRIVATE VirtualBox::SDK)
if(WIN32)
target_link_libraries(vbox PUBLIC Uuid Ole32 OleAut32)
else()
target_link_libraries(vbox PUBLIC VirtualBox::XPCOM)
endif()
install(TARGETS vbox
EXPORT vbox-targets
RUNTIME DESTINATION bin COMPONENT shlib
LIBRARY DESTINATION lib COMPONENT shlib
)
install(
FILES
include/libvbox.h
include/libvbox_errors.h
include/libvbox_interfaces.h
include/libvbox_vboxsdk_types.h
include/libvbox_wrap.h
"${CMAKE_CURRENT_BINARY_DIR}/include/libvbox_vboxsdk_version.h"
DESTINATION include
COMPONENT devel
)
export(TARGETS vbox
NAMESPACE libvbox::
FILE "${CMAKE_CURRENT_BINARY_DIR}/vbox-targets.cmake"
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(libvbox-config-version.cmake
VERSION 1.0
COMPATIBILITY AnyNewerVersion
)
install(
FILES
libvbox-config.cmake
"${CMAKE_CURRENT_BINARY_DIR}/libvbox-config-version.cmake"
DESTINATION lib/cmake/libvbox
COMPONENT devel
)
install(EXPORT vbox-targets
DESTINATION lib/cmake/libvbox
NAMESPACE libvbox::
COMPONENT devel
)