CMakeLists.txt 16.3 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 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
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()
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()
65 66 67
if(ENABLE_TUNNEL)
	add_definitions(-DTUNNEL_ENABLED)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
68

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

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

353 354
set(LINPHONE_OBJC_SOURCE_FILES)
if (APPLE)
355 356
	list(APPEND LINPHONE_OBJC_SOURCE_FILES core/paths/paths-apple.mm)
	list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-apple.h)
357
	list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/platform-helpers/ios-platform-helpers.cpp)
358 359
elseif (ANDROID)
	list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-android.cpp core/platform-helpers/android-platform-helpers.cpp)
360
	list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-android.h)
361
elseif (WIN32)
362 363
	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)
364
elseif (UNIX)
365 366
	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)
367
endif ()
368

369 370 371 372 373 374
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS
	${BELR_INCLUDE_DIRS}
	${LIBXSD_INCLUDE_DIRS}
	${SOCI_INCLUDE_DIRS}
	${SOCI_MYSQL_INCLUDES}
)
375 376
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS})

377
set(LINPHONE_PRIVATE_HEADER_FILES)
378
foreach (header ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES})
379
	list(APPEND LINPHONE_PRIVATE_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${header}")
380
endforeach ()
381 382
set(LINPHONE_PRIVATE_HEADER_FILES ${LINPHONE_PRIVATE_HEADER_FILES} PARENT_SCOPE)

383 384 385
if (ANDROID AND CMAKE_C_COMPILER_ID STREQUAL "GNU") 
	list(APPEND STRICT_OPTIONS_CXX "-Wno-attributes")
endif()
386
bc_apply_compile_flags(LINPHONE_CXX_OBJECTS_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
Benjamin REIS's avatar
Benjamin REIS committed
387
bc_apply_compile_flags(LINPHONE_OBJC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
388

Ghislain MARY's avatar
Ghislain MARY committed
389 390 391

if(ENABLE_STATIC)
	add_library(linphone-static STATIC ${LINPHONE_HEADER_FILES}
392
		${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
Ghislain MARY's avatar
Ghislain MARY committed
393
		$<TARGET_OBJECTS:linphone-coreapi-static>
394
	)
Ghislain MARY's avatar
Ghislain MARY committed
395 396 397 398 399 400 401 402 403 404 405 406
	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)
jehan's avatar
jehan committed
407
	set(LINPHONE_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../share/cpim_grammar") #keep it relative to current dir to allow CMakeList inclusion
408
	add_library(linphone SHARED ${LINPHONE_RESOURCES} ${LINPHONE_HEADER_FILES}
409
		${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
Ghislain MARY's avatar
Ghislain MARY committed
410
		$<TARGET_OBJECTS:linphone-coreapi>
411
	)
412
	target_compile_definition(linphone PRIVATE "-DLINPHONE_EXPORTS")
413
	#TODO: replace by if(APPLE) when we want to make apple framework on linphone-desktop too
Ghislain MARY's avatar
Ghislain MARY committed
414 415 416 417 418 419 420 421 422 423 424
	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
425
			RESOURCE ${LINPHONE_RESOURCES}
Ghislain MARY's avatar
Ghislain MARY committed
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
		)
	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()
444
	if(WIN32)
445
		# Export Xerces and Soci symbols.
446
		target_compile_definitions(linphone PRIVATE "-DDLL_EXPORT" "-DSOCI_DLL")
447 448 449
		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
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
	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()
469

Ghislain MARY's avatar
Ghislain MARY committed
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
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()