1############################################################################
2# Mediastreamer2Config.cmake
3# Copyright (C) 2015  Belledonne Communications, Grenoble France
4#
5############################################################################
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation; either version 2
10# of the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20#
21############################################################################
22#
23# Config file for the mediastreamer2 package.
24# It defines the following variables:
25#
26#  MEDIASTREAMER2_FOUND - system has mediastreamer2
27#  MEDIASTREAMER2_INCLUDE_DIRS - the mediastreamer2 include directory
28#  MEDIASTREAMER2_LIBRARIES - The libraries needed to use mediastreamer2
29#  MEDIASTREAMER2_CPPFLAGS - The compilation flags needed to use mediastreamer2
30#  MEDIASTREAMER2_LDFLAGS - The linking flags needed to use mediastreamer2
31
32if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
33	include("${CMAKE_CURRENT_LIST_DIR}/Mediastreamer2Targets.cmake")
34endif()
35
36if(@ENABLE_SHARED@)
37	set(MEDIASTREAMER2_TARGETNAME mediastreamer_voip)
38	set(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} mediastreamer_base)
39else()
40	set(MEDIASTREAMER2_TARGETNAME mediastreamer_voip-static)
41	if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
42		set(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME})
43	else()
44		get_target_property(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} LOCATION)
45	endif()
46	get_target_property(MEDIASTREAMER2_LINK_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} INTERFACE_LINK_LIBRARIES)
47	if(MEDIASTREAMER2_LINK_LIBRARIES)
48		list(APPEND MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_LINK_LIBRARIES})
49		list(REMOVE_ITEM MEDIASTREAMER2_LIBRARIES mediastreamer_base-static)
50		if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
51			set(MEDIASTREAMER2_BASE_LIBRARIES mediastreamer_base-static)
52		else()
53			get_target_property(MEDIASTREAMER2_BASE_LIBRARIES mediastreamer_base-static LOCATION)
54		endif()
55		list(APPEND MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_BASE_LIBRARIES})
56	endif()
57endif()
58get_target_property(MEDIASTREAMER2_INCLUDE_DIRS ${MEDIASTREAMER2_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
59if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
60	list(INSERT MEDIASTREAMER2_INCLUDE_DIRS 0 "${EP_ms2_INCLUDE_DIR}")
61else()
62	list(INSERT MEDIASTREAMER2_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
63endif()
64list(REMOVE_DUPLICATES MEDIASTREAMER2_INCLUDE_DIRS)
65
66set(MEDIASTREAMER2_CPPFLAGS @MEDIASTREAMER2_CPPFLAGS@)
67set(MEDIASTREAMER2_LDFLAGS "@LINK_FLAGS_STR@")
68set(MEDIASTREAMER2_FOUND 1)
69