CMakeLists.txt 16.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
############################################################################
# CMakeLists.txt
# Copyright (C) 2017  Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU 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.
#
############################################################################

Ghislain MARY's avatar
Ghislain MARY committed
23 24 25 26 27 28 29 30 31 32 33 34
set(LIBS
	${BCTOOLBOX_CORE_LIBRARIES}
	${BELLESIP_LIBRARIES}
	${MEDIASTREAMER2_LIBRARIES}
	${ORTP_LIBRARIES}
	${XML2_LIBRARIES}
	${BELR_LIBRARIES}
	${LIBXSD_LIBRARIES}
)
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
	list(APPEND LIBS "Ws2_32")
endif()
35 36 37
if(LIME_FOUND)
	list(APPEND LIBS ${LIME_LIBRARIES})
endif()
Ghislain MARY's avatar
Ghislain MARY committed
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
if(ENABLE_LIME)
	list(APPEND LIBS ${BZRTP_LIBRARIES})
endif()
if(ZLIB_FOUND)
	list(APPEND LIBS ${ZLIB_LIBRARIES})
endif()
if(SOCI_FOUND)
	list(APPEND LIBS ${SOCI_LIBRARIES})
endif()
if(SQLITE3_FOUND)
	list(APPEND LIBS ${SQLITE3_LIBRARIES})
endif()
if(ICONV_FOUND)
	list(APPEND LIBS ${ICONV_LIBRARIES})
endif()
if(ENABLE_TUNNEL)
	list(APPEND LIBS ${TUNNEL_LIBRARIES})
endif()
if(MSVC AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
	list(APPEND LIBS ${LIBGCC} ${LIBMINGWEX})
endif()
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
	list(APPEND LIBS shlwapi)
endif()
if(INTL_FOUND)
	list(APPEND LIBS ${INTL_LIBRARIES})
endif()
if(BELCARD_FOUND)
	list(APPEND LIBS ${BELCARD_LIBRARIES})
endif()
68 69 70
if(ENABLE_TUNNEL)
	add_definitions(-DTUNNEL_ENABLED)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
71

72 73 74
#define log domain for this part of code
add_definitions(-DBCTBX_LOG_DOMAIN="liblinphone")

75
set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
76
	address/address-p.h
77
	address/address.h
78
	address/identity-address.h
79
	c-wrapper/c-wrapper.h
80
	c-wrapper/internal/c-sal.h
Ronan's avatar
Ronan committed
81
	c-wrapper/internal/c-tools.h
82
	call/call-p.h
83
	call/call.h
84 85 86 87
	call/local-conference-call-p.h
	call/local-conference-call.h
	call/remote-conference-call-p.h
	call/remote-conference-call.h
Ronan's avatar
Ronan committed
88 89
	chat/chat-message/chat-message-p.h
	chat/chat-message/chat-message.h
Ghislain MARY's avatar
Ghislain MARY committed
90
	chat/chat-message/imdn-message.h
91
	chat/chat-message/imdn-message-p.h
92
	chat/chat-message/is-composing-message.h
93
	chat/chat-message/notification-message.h
94
	chat/chat-message/notification-message-p.h
95 96
	chat/chat-room/abstract-chat-room-p.h
	chat/chat-room/abstract-chat-room.h
Ronan's avatar
Ronan committed
97 98
	chat/chat-room/basic-chat-room-p.h
	chat/chat-room/basic-chat-room.h
99
	chat/chat-room/basic-to-client-group-chat-room.h
100
	chat/chat-room/chat-room-listener.h
Ronan's avatar
Ronan committed
101 102 103 104
	chat/chat-room/chat-room-p.h
	chat/chat-room/chat-room.h
	chat/chat-room/client-group-chat-room-p.h
	chat/chat-room/client-group-chat-room.h
105 106 107
	chat/chat-room/client-group-to-basic-chat-room.h
	chat/chat-room/proxy-chat-room-p.h
	chat/chat-room/proxy-chat-room.h
Ronan's avatar
Ronan committed
108 109
	chat/chat-room/real-time-text-chat-room-p.h
	chat/chat-room/real-time-text-chat-room.h
110 111
	chat/chat-room/server-group-chat-room-p.h
	chat/chat-room/server-group-chat-room.h
Ronan's avatar
Ronan committed
112 113 114 115 116 117 118
	chat/cpim/cpim.h
	chat/cpim/header/cpim-core-headers.h
	chat/cpim/header/cpim-generic-header.h
	chat/cpim/header/cpim-header-p.h
	chat/cpim/header/cpim-header.h
	chat/cpim/message/cpim-message.h
	chat/cpim/parser/cpim-parser.h
Matthieu Tanon's avatar
Matthieu Tanon committed
119
	chat/encryption/encryption-engine.h
120
	chat/encryption/legacy-encryption-engine.h
Matthieu Tanon's avatar
Matthieu Tanon committed
121
	chat/encryption/lime-x3dh-encryption-engine.h
122 123
	chat/modifier/chat-message-modifier.h
	chat/modifier/cpim-chat-message-modifier.h
124
	chat/modifier/encryption-chat-message-modifier.h
125
	chat/modifier/file-transfer-chat-message-modifier.h
126
	chat/modifier/multipart-chat-message-modifier.h
127 128
	chat/notification/imdn.h
	chat/notification/is-composing-listener.h
129
	chat/notification/is-composing.h
130
	conference/conference-id.h
131
	conference/conference-listener.h
132
	conference/conference-p.h
133
	conference/conference.h
134 135
	conference/handlers/local-conference-event-handler-p.h
	conference/handlers/local-conference-event-handler.h
Benjamin REIS's avatar
Benjamin REIS committed
136
	conference/handlers/local-conference-list-event-handler.h
137 138
	conference/handlers/remote-conference-event-handler-p.h
	conference/handlers/remote-conference-event-handler.h
Benjamin REIS's avatar
Benjamin REIS committed
139
	conference/handlers/remote-conference-list-event-handler.h
140
	conference/local-conference-p.h
Ronan's avatar
Ronan committed
141
	conference/local-conference.h
142
	conference/params/call-session-params-p.h
143
	conference/params/call-session-params.h
144
	conference/params/media-session-params-p.h
145
	conference/params/media-session-params.h
146
	conference/participant-device.h
147 148
	conference/participant-imdn-state.h
	conference/participant-imdn-state-p.h
149
	conference/participant-p.h
150
	conference/participant.h
151
	conference/remote-conference-p.h
Ronan's avatar
Ronan committed
152
	conference/remote-conference.h
153
	conference/session/call-session-listener.h
154
	conference/session/call-session-p.h
155
	conference/session/call-session.h
156
	conference/session/media-session.h
157
	conference/session/port-config.h
158
	containers/lru-cache.h
159
	content/content-disposition.h
160
	content/content-manager.h
161
	content/content-p.h
162 163
	content/content-type.h
	content/content.h
164 165
	content/file-content.h
	content/file-transfer-content.h
166 167 168
	content/header/header.h
	content/header/header-p.h
	content/header/header-param.h
169
	core/core-accessor.h
170
	core/core-listener.h
171
	core/core-p.h
172
	core/core.h
173 174
	core/paths/paths.h
	core/platform-helpers/platform-helpers.h
Ronan's avatar
Ronan committed
175 176
	db/abstract/abstract-db-p.h
	db/abstract/abstract-db.h
177 178
	db/internal/db-transaction.h
	db/internal/statements.h
179
	db/main-db-chat-message-key.h
180
	db/main-db-event-key.h
181 182
	db/main-db-key-p.h
	db/main-db-key.h
183
	db/main-db-p.h
184
	db/main-db.h
Ronan's avatar
Ronan committed
185
	db/session/db-session.h
186 187
	dial-plan/dial-plan-p.h
	dial-plan/dial-plan.h
188
	enums.h
189
	event-log/conference/conference-call-event.h
190 191 192 193 194 195 196
	event-log/conference/conference-event-p.h
	event-log/conference/conference-event.h
	event-log/conference/conference-notified-event-p.h
	event-log/conference/conference-notified-event.h
	event-log/conference/conference-participant-device-event.h
	event-log/conference/conference-participant-event-p.h
	event-log/conference/conference-participant-event.h
197
	event-log/conference/conference-security-event.h
198
	event-log/conference/conference-subject-event.h
Ronan's avatar
Ronan committed
199 200
	event-log/event-log-p.h
	event-log/event-log.h
201
	event-log/events.h
Ghislain MARY's avatar
Ghislain MARY committed
202
	hacks/hacks.h
Ronan's avatar
Ronan committed
203
	logger/logger.h
204 205
	nat/ice-agent.h
	nat/stun-client.h
Ronan's avatar
Ronan committed
206
	object/app-data-container.h
207 208
	object/base-object-p.h
	object/base-object.h
209
	object/clonable-object-p.h
Ronan's avatar
Ronan committed
210
	object/clonable-object.h
211
	object/clonable-shared-pointer.h
212 213
	object/object-head-p.h
	object/object-head.h
214
	object/object-p.h
Ronan's avatar
Ronan committed
215
	object/object.h
216
	object/property-container.h
217
	object/singleton.h
218
	sal/sal.h
Erwan Croze's avatar
Erwan Croze committed
219
	search/magic-search-p.h
220 221
	search/magic-search.h
	search/search-result.h
222
	utils/background-task.h
223
	utils/general-internal.h
224
	utils/payload-type-handler.h
225
	variant/variant.h
226
	xml/conference-info.h
227
	xml/imdn.h
228
	xml/is-composing.h
229
	xml/linphone-imdn.h
230
	xml/resource-lists.h
Benjamin REIS's avatar
Benjamin REIS committed
231
	xml/rlmi.h
232
	xml/xml.h
233 234 235
)

set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
236
	address/address.cpp
237
	address/identity-address.cpp
238
	c-wrapper/api/c-address.cpp
239
	c-wrapper/api/c-call-cbs.cpp
240
	c-wrapper/api/c-call-params.cpp
241
	c-wrapper/api/c-call-stats.cpp
Ronan's avatar
Ronan committed
242
	c-wrapper/api/c-call.cpp
243
	c-wrapper/api/c-chat-message-cbs.cpp
Ronan's avatar
Ronan committed
244
	c-wrapper/api/c-chat-message.cpp
245
	c-wrapper/api/c-chat-room-cbs.cpp
Ronan's avatar
Ronan committed
246
	c-wrapper/api/c-chat-room.cpp
247
	c-wrapper/api/c-core.cpp
248
	c-wrapper/api/c-content.cpp
249
	c-wrapper/api/c-dial-plan.cpp
Ronan's avatar
Ronan committed
250
	c-wrapper/api/c-event-log.cpp
Erwan Croze's avatar
Erwan Croze committed
251
	c-wrapper/api/c-magic-search.cpp
252
	c-wrapper/api/c-participant.cpp
253
	c-wrapper/api/c-participant-device.cpp
254
	c-wrapper/api/c-participant-imdn-state.cpp
Erwan Croze's avatar
Erwan Croze committed
255
	c-wrapper/api/c-search-result.cpp
256
	c-wrapper/internal/c-sal.cpp
257
	c-wrapper/internal/c-tools.cpp
258
	call/call.cpp
259 260
	call/local-conference-call.cpp
	call/remote-conference-call.cpp
Ronan's avatar
Ronan committed
261
	chat/chat-message/chat-message.cpp
Ghislain MARY's avatar
Ghislain MARY committed
262
	chat/chat-message/imdn-message.cpp
263
	chat/chat-message/is-composing-message.cpp
264
	chat/chat-message/notification-message.cpp
265
	chat/chat-room/abstract-chat-room.cpp
Ronan's avatar
Ronan committed
266
	chat/chat-room/basic-chat-room.cpp
267
	chat/chat-room/basic-to-client-group-chat-room.cpp
Ronan's avatar
Ronan committed
268 269
	chat/chat-room/chat-room.cpp
	chat/chat-room/client-group-chat-room.cpp
270 271
	chat/chat-room/client-group-to-basic-chat-room.cpp
	chat/chat-room/proxy-chat-room.cpp
Ronan's avatar
Ronan committed
272
	chat/chat-room/real-time-text-chat-room.cpp
273
	chat/chat-room/server-group-chat-room.cpp
Ronan's avatar
Ronan committed
274 275 276 277 278
	chat/cpim/header/cpim-core-headers.cpp
	chat/cpim/header/cpim-generic-header.cpp
	chat/cpim/header/cpim-header.cpp
	chat/cpim/message/cpim-message.cpp
	chat/cpim/parser/cpim-parser.cpp
279
	chat/encryption/legacy-encryption-engine.cpp
Matthieu Tanon's avatar
Matthieu Tanon committed
280
	chat/encryption/lime-x3dh-encryption-engine.cpp
281
	chat/modifier/cpim-chat-message-modifier.cpp
282
	chat/modifier/encryption-chat-message-modifier.cpp
283
	chat/modifier/file-transfer-chat-message-modifier.cpp
284
	chat/modifier/multipart-chat-message-modifier.cpp
285 286
	chat/notification/imdn.cpp
	chat/notification/is-composing.cpp
287
	conference/conference-id.cpp
288
	conference/conference.cpp
289
	conference/handlers/local-conference-event-handler.cpp
Benjamin REIS's avatar
Benjamin REIS committed
290
	conference/handlers/local-conference-list-event-handler.cpp
291
	conference/handlers/remote-conference-event-handler.cpp
Benjamin REIS's avatar
Benjamin REIS committed
292
	conference/handlers/remote-conference-list-event-handler.cpp
Ronan's avatar
Ronan committed
293
	conference/local-conference.cpp
294 295
	conference/params/call-session-params.cpp
	conference/params/media-session-params.cpp
296
	conference/participant-device.cpp
297
	conference/participant-imdn-state.cpp
298
	conference/participant.cpp
Ronan's avatar
Ronan committed
299
	conference/remote-conference.cpp
300 301
	conference/session/call-session.cpp
	conference/session/media-session.cpp
302
	content/content-disposition.cpp
303
	content/content-manager.cpp
304 305
	content/content-type.cpp
	content/content.cpp
306 307
	content/file-content.cpp
	content/file-transfer-content.cpp
308 309
	content/header/header.cpp
	content/header/header-param.cpp
310
	core/core-accessor.cpp
311
	core/core-call.cpp
312
	core/core-chat-room.cpp
313
	core/core.cpp
314 315
	core/paths/paths.cpp
	core/platform-helpers/platform-helpers.cpp
Ronan's avatar
Ronan committed
316
	db/abstract/abstract-db.cpp
317
	db/internal/statements.cpp
318
	db/main-db-chat-message-key.cpp
319
	db/main-db-event-key.cpp
320
	db/main-db-key.cpp
321
	db/main-db.cpp
322
	db/session/db-session.cpp
323
	dial-plan/dial-plan.cpp
324
	event-log/conference/conference-call-event.cpp
325
	event-log/conference/conference-chat-message-event.cpp
326 327 328 329
	event-log/conference/conference-event.cpp
	event-log/conference/conference-notified-event.cpp
	event-log/conference/conference-participant-device-event.cpp
	event-log/conference/conference-participant-event.cpp
330
	event-log/conference/conference-security-event.cpp
331
	event-log/conference/conference-subject-event.cpp
Ronan's avatar
Ronan committed
332
	event-log/event-log.cpp
Ghislain MARY's avatar
Ghislain MARY committed
333
	hacks/hacks.cpp
Ronan's avatar
Ronan committed
334
	logger/logger.cpp
335 336
	nat/ice-agent.cpp
	nat/stun-client.cpp
Ronan's avatar
Ronan committed
337
	object/app-data-container.cpp
338
	object/base-object.cpp
339
	object/clonable-object.cpp
340
	object/object.cpp
341
	object/property-container.cpp
342 343 344 345 346
	sal/call-op.cpp
	sal/event-op.cpp
	sal/message-op.cpp
	sal/op.cpp
	sal/presence-op.cpp
Ronan's avatar
Ronan committed
347
	sal/refer-op.cpp
348 349
	sal/register-op.cpp
	sal/sal.cpp
Erwan Croze's avatar
Erwan Croze committed
350 351
	search/magic-search.cpp
	search/search-result.cpp
352
	utils/background-task.cpp
353
	utils/fs.cpp
354
	utils/general.cpp
355
	utils/payload-type-handler.cpp
356
	utils/utils.cpp
357
	variant/variant.cpp
358
	xml/conference-info.cpp
359
	xml/imdn.cpp
360
	xml/is-composing.cpp
361
	xml/linphone-imdn.cpp
362
	xml/resource-lists.cpp
Benjamin REIS's avatar
Benjamin REIS committed
363
	xml/rlmi.cpp
364
	xml/xml.cpp
365 366
)

367 368
set(LINPHONE_OBJC_SOURCE_FILES)
if (APPLE)
369 370
	list(APPEND LINPHONE_OBJC_SOURCE_FILES core/paths/paths-apple.mm)
	list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-apple.h)
371
	list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/platform-helpers/ios-platform-helpers.cpp)
372 373
elseif (ANDROID)
	list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-android.cpp core/platform-helpers/android-platform-helpers.cpp)
374
	list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-android.h)
375
elseif (WIN32)
376 377
	list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-windows.cpp)
	list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-windows.h)
378
elseif (UNIX)
379 380
	list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-linux.cpp)
	list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-linux.h)
381
endif ()
382

383 384 385 386 387 388
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS
	${BELR_INCLUDE_DIRS}
	${LIBXSD_INCLUDE_DIRS}
	${SOCI_INCLUDE_DIRS}
	${SOCI_MYSQL_INCLUDES}
)
389 390
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS})

391
set(LINPHONE_PRIVATE_HEADER_FILES)
392
foreach (header ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES})
393
	list(APPEND LINPHONE_PRIVATE_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${header}")
394
endforeach ()
395 396
set(LINPHONE_PRIVATE_HEADER_FILES ${LINPHONE_PRIVATE_HEADER_FILES} PARENT_SCOPE)

397 398 399
if (ANDROID AND CMAKE_C_COMPILER_ID STREQUAL "GNU") 
	list(APPEND STRICT_OPTIONS_CXX "-Wno-attributes")
endif()
400
bc_apply_compile_flags(LINPHONE_CXX_OBJECTS_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
Benjamin REIS's avatar
Benjamin REIS committed
401
bc_apply_compile_flags(LINPHONE_OBJC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
402

Ghislain MARY's avatar
Ghislain MARY committed
403 404 405

if(ENABLE_STATIC)
	add_library(linphone-static STATIC ${LINPHONE_HEADER_FILES}
406
		${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
Ghislain MARY's avatar
Ghislain MARY committed
407
		$<TARGET_OBJECTS:linphone-coreapi-static>
408
	)
Ghislain MARY's avatar
Ghislain MARY committed
409 410 411 412 413 414 415 416 417 418 419 420
	set_target_properties(linphone-static PROPERTIES OUTPUT_NAME linphone)
	target_include_directories(linphone-static PUBLIC ${LINPHONE_INCLUDE_DIRS})
	target_link_libraries(linphone-static INTERFACE ${LIBS})
	if(APPLE)
		target_link_libraries(linphone-static INTERFACE "-framework Foundation" "-framework AVFoundation")
	endif()
	install(TARGETS linphone-static EXPORT ${EXPORT_TARGETS_NAME}Targets
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
endif()
if(ENABLE_SHARED)
421 422 423 424
	set(LINPHONE_RESOURCES
		"${CMAKE_CURRENT_SOURCE_DIR}/../share/cpim_grammar"
		"${CMAKE_CURRENT_SOURCE_DIR}/../share/rootca.pem"
	) # Keep it relative to current dir to allow CMakeList inclusion
425
	add_library(linphone SHARED ${LINPHONE_RESOURCES} ${LINPHONE_HEADER_FILES}
426
		${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
Ghislain MARY's avatar
Ghislain MARY committed
427
		$<TARGET_OBJECTS:linphone-coreapi>
428
	)
François Grisez's avatar
François Grisez committed
429
	target_compile_definitions(linphone PRIVATE "-DLINPHONE_EXPORTS")
430
	#TODO: replace by if(APPLE) when we want to make apple framework on linphone-desktop too
Ghislain MARY's avatar
Ghislain MARY committed
431 432 433 434 435 436 437 438 439 440 441
	if(IOS)
		if(IOS)
			set(MIN_OS ${LINPHONE_IOS_DEPLOYMENT_TARGET})
		else()
			set(MIN_OS ${CMAKE_OSX_DEPLOYMENT_TARGET})
		endif()
		set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/osx/")
		set_target_properties(linphone PROPERTIES
			FRAMEWORK TRUE
			MACOSX_FRAMEWORK_IDENTIFIER org.linphone.linphone
			MACOSX_FRAMEWORK_INFO_PLIST Info.plist.in
442
			RESOURCE "${LINPHONE_RESOURCES}"
Ghislain MARY's avatar
Ghislain MARY committed
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
		)
	endif()
	if(BELCARD_FOUND)
		if(APPLE)
			set_target_properties(linphone PROPERTIES LINK_FLAGS "-stdlib=libc++")
		endif()
	endif()

	set_target_properties(linphone PROPERTIES LINKER_LANGUAGE CXX)
	if(NOT ANDROID)
		# Do not version shared library on Android
		set_target_properties(linphone PROPERTIES SOVERSION ${LINPHONE_SO_VERSION})
	endif()
	target_include_directories(linphone PUBLIC ${LINPHONE_INCLUDE_DIRS})
	target_link_libraries(linphone PRIVATE ${LIBS})
	if(APPLE)
		target_link_libraries(linphone PRIVATE "-framework Foundation" "-framework AVFoundation")
	endif()
461
	if(WIN32)
462
		# Export Xerces and Soci symbols.
463
		target_compile_definitions(linphone PRIVATE "-DDLL_EXPORT" "-DSOCI_DLL")
464 465 466
		if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
			set_target_properties(linphone PROPERTIES PREFIX "lib")
		endif()
Ghislain MARY's avatar
Ghislain MARY committed
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
	elseif(ANDROID)
		target_link_libraries(linphone PUBLIC "log" ${SUPPORT_LIBRARIES} ${CPUFEATURES_LIBRARIES})
	endif()
	if(MSVC)
		if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
			install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/linphone.pdb
				DESTINATION ${CMAKE_INSTALL_BINDIR}
				PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
			)
		endif()
	endif()
	install(TARGETS linphone EXPORT ${EXPORT_TARGETS_NAME}Targets
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
		FRAMEWORK DESTINATION Frameworks
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
endif()
486

Ghislain MARY's avatar
Ghislain MARY committed
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
if(ICONV_FOUND)
	if(APPLE)
		# Prevent conflict between the system iconv.h header and the one from macports.
		if(ENABLE_STATIC)
			target_compile_options(linphone-static PRIVATE "-include" "${ICONV_INCLUDE_DIRS}/iconv.h")
		endif()
		if(ENABLE_SHARED)
			target_compile_options(linphone PRIVATE "-include" "${ICONV_INCLUDE_DIRS}/iconv.h")
		endif()
	else()
		if(ENABLE_STATIC)
			target_include_directories(linphone-static PRIVATE ${ICONV_INCLUDE_DIRS})
		endif()
		if(ENABLE_SHARED)
			target_include_directories(linphone PRIVATE ${ICONV_INCLUDE_DIRS})
		endif()
	endif()
endif()