BcToolboxConfig.cmake.in 3.39 KB
Newer Older
jehan's avatar
jehan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
############################################################################
# BcToolboxConfig.cmake
# Copyright (C) 2015  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
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
jehan's avatar
jehan committed
20 21 22
#
############################################################################
#
23 24 25
# Config file for the bctoolbox package.
# Some components can be asked for: core, tester.
#
jehan's avatar
jehan committed
26 27 28 29 30
# It defines the following variables:
#
#  BCTOOLBOX_FOUND - system has bctoolbox
#  BCTOOLBOX_INCLUDE_DIRS - the bctoolbox include directory
#  BCTOOLBOX_LIBRARIES - The libraries needed to use bctoolbox
31
#  BCTOOLBOX_CPPFLAGS - The compilation flags needed to use bctoolbox
jehan's avatar
jehan committed
32
#  BCTOOLBOX_LDFLAGS - The linking flags needed to use bctoolbox
33 34 35
#  BCTOOLBOX_${comp}_FOUND - system has bctoolbox "comp" component
#  BCTOOLBOX_${comp}_INCLUDE_DIRS - the bctoolbox "comp" component include directory
#  BCTOOLBOX_${comp}_LIBRARIES - The libraries needed to use bctoolbox "comp" component
jehan's avatar
jehan committed
36

37 38
include("${CMAKE_CURRENT_LIST_DIR}/BcToolboxCMakeUtils.cmake")

jehan's avatar
jehan committed
39 40 41 42
if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
	include("${CMAKE_CURRENT_LIST_DIR}/BcToolboxTargets.cmake")
endif()

43 44 45 46
list(APPEND BcToolbox_FIND_COMPONENTS core)
list(REMOVE_DUPLICATES BcToolbox_FIND_COMPONENTS)
set(BcToolbox_FIND_REQUIRED_core TRUE)

47
set(BCTOOLBOX_CPPFLAGS @BCTOOLBOX_CPPFLAGS@)
jehan's avatar
jehan committed
48
set(BCTOOLBOX_LDFLAGS "@LINK_FLAGS_STR@")
49 50 51 52
set(BCTOOLBOX_LIBRARIES )
foreach(comp ${BcToolbox_FIND_COMPONENTS})
	string(TOUPPER ${comp} uppercomp)
	if(comp STREQUAL "core")
53
		set(targetname bctoolbox)
54
	else()
55
		set(targetname bctoolbox-${comp})
56
	endif()
57 58 59 60
	if(@ENABLE_SHARED@)
		set(BCTOOLBOX_${uppercomp}_LIBRARIES ${targetname})
	else()
		set(targetname ${targetname}-static)
61
		bc_set_libraries_from_static_target(BCTOOLBOX_${uppercomp}_LIBRARIES ${targetname})
62 63
	endif()
	if(TARGET ${targetname})
64 65 66 67 68 69 70 71 72
		get_target_property(BCTOOLBOX_${uppercomp}_INCLUDE_DIRS ${targetname} INTERFACE_INCLUDE_DIRECTORIES)
		if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
			list(INSERT BCTOOLBOX_${uppercomp}_INCLUDE_DIRS 0 "${EP_bctoolbox_INCLUDE_DIR}")
		else()
			list(INSERT BCTOOLBOX_${uppercomp}_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
		endif()
		list(REMOVE_DUPLICATES BCTOOLBOX_${uppercomp}_INCLUDE_DIRS)
		list(APPEND BCTOOLBOX_LIBRARIES ${BCTOOLBOX_${uppercomp}_LIBRARIES})
		list(APPEND BCTOOLBOX_INCLUDE_DIRS ${BCTOOLBOX_${uppercomp}_INCLUDE_DIRS})
73 74 75 76 77 78 79 80
		set(BCTOOLBOX_${uppercomp}_FOUND 1)
		if(comp STREQUAL "core")
			set(BCTOOLBOX_FOUND 1)
		endif()
	elseif(BcToolbox_FIND_REQUIRED_${comp})
		message(FATAL_ERROR "Required bctoolbox component \"${comp}\" cannot be found")
	endif()
endforeach()
81 82 83
if(BCTOOLBOX_INCLUDE_DIRS)
	list(REMOVE_DUPLICATES BCTOOLBOX_INCLUDE_DIRS)
endif()
84